Beispiel #1
0
 /**
  * Response on authorized request.
  *
  * @param  \Illuminate\Http\Request  $request
  *
  * @return mixed
  */
 protected function responseOnUnauthorized($request)
 {
     if ($request->ajax()) {
         return $this->response->make('Unauthorized', 401);
     }
     $type = $this->auth->guest() ? 'guest' : 'user';
     $url = $this->config->get("orchestra/foundation::routes.{$type}");
     return $this->response->redirectTo($this->foundation->handles($url));
 }
 /**
  * Get all possible user roles.
  *
  * @return array
  */
 protected function getUserRoles()
 {
     if (!is_null($this->userRoles)) {
         return $this->userRoles;
     } elseif (!$this->auth->guest()) {
         return $this->auth->roles();
     }
     return $this->roles->has('guest') ? ['guest'] : [];
 }
Beispiel #3
0
 /**
  * Check whether the menu should be displayed.
  *
  * @param  \Orchestra\Contracts\Auth\Guard  $auth
  *
  * @return bool
  */
 public function authorize(Guard $auth)
 {
     return !$auth->guest();
 }