Returns the role repository.
public getRoleRepository ( ) : Cartalyst\Sentinel\Roles\RoleRepositoryInterface | ||
return | Cartalyst\Sentinel\Roles\RoleRepositoryInterface |
/** * {@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; }
/** * Returns the role repository. * * @return RoleRepository */ public function roles() { return $this->sentinel->getRoleRepository(); }
/** * Returns the role repository. * * @return \Cartalyst\Sentinel\Roles\RoleRepositoryInterface * @static */ public static function getRoleRepository() { return \Cartalyst\Sentinel\Sentinel::getRoleRepository(); }