getRoleRepository() публичный Метод

Returns the role repository.
public getRoleRepository ( ) : Cartalyst\Sentinel\Roles\RoleRepositoryInterface
Результат Cartalyst\Sentinel\Roles\RoleRepositoryInterface
Пример #1
0
 /**
  * {@inheritDoc}
  */
 public function create(array $data, $validate = true)
 {
     $this->rules = ['slug' => 'required|alpha_dash|unique:roles', 'name' => 'required|alpha_dash|unique:roles'];
     if ($validate) {
         $this->validate($data);
     }
     // Convert the checkbox values of "1" to true, so permission checking works with Sentinel.
     if (isset($data['permissions'])) {
         foreach ($data['permissions'] as $permission => $value) {
             $data['permissions'][$permission] = true;
         }
     }
     try {
         $role = $this->sentinel->getRoleRepository()->createModel()->create($data);
     } catch (QueryException $e) {
         throw new RolesException(trans('dashboard::dashboard.errors.role.create'));
     }
     return $role;
 }
Пример #2
0
 /**
  * Returns the role repository.
  *
  * @return RoleRepository
  */
 public function roles()
 {
     return $this->sentinel->getRoleRepository();
 }
Пример #3
0
 /**
  * Returns the role repository.
  *
  * @return \Cartalyst\Sentinel\Roles\RoleRepositoryInterface 
  * @static 
  */
 public static function getRoleRepository()
 {
     return \Cartalyst\Sentinel\Sentinel::getRoleRepository();
 }