/** * {@inheritDoc} */ public function registerAndActivate(array $data, $validate = true) { $this->rules = ['email' => 'required|unique:users', 'password' => 'required|confirmed', 'password_confirmation' => 'required']; if ($validate) { $this->validate($data); } try { $user = $this->sentinel->registerAndActivate($data); } catch (QueryException $e) { throw new AuthenticationException(trans('dashboard::dashboard.errors.auth.create')); } if (!isset($data['role'])) { $data['role'] = config('laraflock.dashboard.defaultRole'); } if (!($role = $this->sentinel->findRoleBySlug($data['role']))) { throw new RolesException(trans('dashboard::dashboard.errors.role.found')); } $role->users()->attach($user); return; }
/** * {@inheritDoc} */ public function getBySlug($slug) { return $this->sentinel->findRoleBySlug($slug); }