當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Person::getRoles方法代碼示例

本文整理匯總了PHP中app\models\Person::getRoles方法的典型用法代碼示例。如果您正苦於以下問題:PHP Person::getRoles方法的具體用法?PHP Person::getRoles怎麽用?PHP Person::getRoles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Person的用法示例。


在下文中一共展示了Person::getRoles方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: userSettings

 /**
  * Administrator can view settings of a certain user
  *
  * @param integer $userId
  * @param Request $request
  *
  * @return
  */
 public function userSettings($userId, Request $request)
 {
     if (empty($request->user()) || !$request->user()->hasRole('administrator')) {
         return redirect('/');
     }
     $user = $this->users->getById($userId);
     if (empty($user)) {
         abort(404);
     }
     // The person to view the profile of
     $person = new Person();
     $person->setNode($user);
     $fullUser = $user->getProperties();
     unset($fullUser['created_at']);
     unset($fullUser['MEDEA_UUID']);
     unset($fullUser['password']);
     unset($fullUser['remember_token']);
     unset($fullUser['token']);
     unset($fullUser['updated_at']);
     unset($fullUser['verified']);
     $fullUser['id'] = $userId;
     return view('pages.settings', ['accessLevels' => $this->getProfileAccessLevels(), 'roles' => $person->getRoles(), 'user' => $fullUser]);
 }
開發者ID:weopendata,項目名稱:medea,代碼行數:31,代碼來源:UserController.php

示例2: sendRegistrationToAdmin

 /**
  * Deliver a registration email to the admin
  *
  * @param Person $user
  * @return void
  */
 public function sendRegistrationToAdmin(Person $user)
 {
     $this->to = env('ADMIN_EMAIL');
     $this->view = 'auth.emails.adminconfirm';
     $roles_string = '';
     foreach ($user->getRoles() as $role) {
         $roles_string .= $role . ',';
     }
     $roles_string = rtrim($roles_string, ',');
     $this->data = ['user' => $user, 'roles' => $roles_string];
     $this->subject = 'Nieuwe registratie';
     $this->deliver();
 }
開發者ID:weopendata,項目名稱:medea,代碼行數:19,代碼來源:AppMailer.php

示例3: getAllWithRoles

 /**
  * Get all the bare nodes of a findEvent
  *
  * @param integer $limit
  * @param integer $offset
  *
  * @return array
  */
 public function getAllWithRoles()
 {
     $client = $this->getClient();
     $findLabel = $client->makeLabel($this->label);
     $findNodes = $findLabel->getNodes();
     $data = [];
     foreach ($findNodes as $findNode) {
         $person = new Person();
         $person->setNode($findNode);
         $personData = array_only($findNode->getProperties(), ['firstName', 'lastName', 'verified']);
         $personData['id'] = $findNode->getId();
         $personData['personType'] = $person->getRoles();
         $data[] = $personData;
     }
     return $data;
 }
開發者ID:weopendata,項目名稱:medea,代碼行數:24,代碼來源:UserRepository.php


注:本文中的app\models\Person::getRoles方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。