本文整理汇总了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'));
}