/** * Index * * Redirect a user depending on his permissions when he browses the backend route. * * @return \Illuminate\Http\RedirectResponse */ public function getIndex() { try { $this->permission->has('access.backend'); } catch (PermissionMissingException $e) { return $this->redirect->route('larapress.home.login.get'); } return $this->redirect->route('larapress.cp.dashboard.get'); }
/** * Redirect the user with a flash message if he's missing permissions to the backend * * @return bool|\Illuminate\HTTP\RedirectResponse */ protected function redirect() { try { $this->permission->has('access.backend'); return false; } catch (PermissionMissingException $e) { return $this->helpers->redirectWithFlashMessage('error', $e->getMessage(), 'larapress.home.login.get'); } }