本文整理汇总了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]);
}
示例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();
}
示例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;
}