Created
October 1, 2013 22:02
-
-
Save vanchelo/6785872 to your computer and use it in GitHub Desktop.
Laravel 4, Sentry
Операции с пользователем
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Получаем пользователя по его ID | |
$user = Sentry::findUserById(1); | |
# Получаем пользователя по его Email или логину | |
# $user = Sentry::findUserByLogin('email@email.com'); | |
# Добавляем пользователя в группу | |
$user->addGroup(Sentry::findGroupByName('Admins')); | |
# Удаляем пользователя из группы | |
$user->removeGroup(Sentry::findGroupByName('Users')); | |
# Даём ему права суперпользователя | |
$user->permissions = ['superuser' => true]; | |
# Сохраняем | |
$user->save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment