Cartalyst\Sentinel\Sentinel::getRoleRepository PHP Method

getRoleRepository() public method

Returns the role repository.
public getRoleRepository ( ) : Cartalyst\Sentinel\Roles\RoleRepositoryInterface
return Cartalyst\Sentinel\Roles\RoleRepositoryInterface
    public function getRoleRepository()
    {
        return $this->roles;
    }

Usage Example

Example #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;
 }
All Usage Examples Of Cartalyst\Sentinel\Sentinel::getRoleRepository