本文整理匯總了PHP中Sentinel::getGroupProvider方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sentinel::getGroupProvider方法的具體用法?PHP Sentinel::getGroupProvider怎麽用?PHP Sentinel::getGroupProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sentinel
的用法示例。
在下文中一共展示了Sentinel::getGroupProvider方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create
/**
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function create()
{
return view('admin.sentinel.users.edit', ['user' => $this->userProvider->createModel(), 'groups' => \Sentinel::getGroupProvider()->findAll(), 'userGroups' => [], 'action' => 'create']);
}
示例2: updateUser
/**
* Updating a user and his person table + group table info.
*
* @param int $id
* @param array $data
*
* @return void
*/
public function updateUser($id, array $data)
{
if (!empty($id) && !empty($data)) {
$this->createModel()->newQuery()->where('id', $id)->update(array('name' => $data['name'], 'email' => $data['email']));
unset($data['name'], $data['email']);
$personID = \Spirit::getPersonProvider()->getPersonByUserId($id)->select(['id as user_id'])->value('user_id');
if (!is_null($personID)) {
if (!isset($data['groups'])) {
$data['groups'] = [];
}
$groupsHaveChanged = \Sentinel::getGroupProvider()->updateUserGroups($id, $data['groups']);
if ($groupsHaveChanged === true) {
\Sentinel::getPermissionProvider()->updateUserGroupPermissions($id, $data['groups']);
}
unset($data['groups']);
\Spirit::getPersonProvider()->updatePerson($personID, $data);
} else {
throw new \UnexpectedValueException('User ' . $id . ' not found for update');
}
} else {
throw new \UnexpectedValueException('Invalid data for user update');
}
}
示例3: __construct
public function __construct()
{
$this->groupProvider = \Sentinel::getGroupProvider();
$this->userGroupProvider = \Sentinel::getUserGroupProvider();
Flash::setMessagedEntity('group');
}
示例4: index
public function index()
{
$userCount = \Sentinel::getUserProvider()->getAllUsersCount();
$groupCount = \Sentinel::getGroupProvider()->getAllGroupsCount();
return view('admin.dashboard', compact('userCount', 'groupCount'));
}