Beispiel #1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->check()) {
         return cms_api()->response('Unauthorized.', 401);
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         /** @var CoreInterface $core */
         $core = app(Component::CORE);
         return redirect()->route($core->prefixRoute(NamedRoute::HOME));
     }
     return $next($request);
 }
Beispiel #3
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->check()) {
         if ($request->ajax() || $request->wantsJson()) {
             return response('Unauthorized.', 401);
         } else {
             /** @var CoreInterface $core */
             $core = app(Component::CORE);
             return redirect()->route($core->prefixRoute(NamedRoute::AUTH_LOGIN));
         }
     }
     return $next($request);
 }
 /**
  * Returns whether a given menu presence should be displayed.
  *
  * @param MenuPresenceInterface $presence
  * @return bool
  */
 protected function shouldMenuPresenceBeShown(MenuPresenceInterface $presence)
 {
     $permissions = $presence->permissions();
     if (empty($permissions)) {
         return true;
     }
     return $this->auth->can($permissions);
 }