guest() public méthode

Create a new redirect response, while putting the current URL in the session.
public guest ( string $path, integer $status = 302, array $headers = [], boolean $secure = null ) : Illuminate\Http\RedirectResponse
$path string
$status integer
$headers array
$secure boolean
Résultat Illuminate\Http\RedirectResponse
 /**
  * Run the request filter.
  *
  * @param Request  $request
  * @param \Closure $next
  * @param string   $context
  *
  * @return mixed
  */
 public function handle(Request $request, \Closure $next, $context)
 {
     list($context, $privacy) = $this->parseContext($context);
     $this->securityContext->bindContext($context, $request);
     try {
         $this->applySecurity($context, $privacy, $request);
         $response = $next($request);
     } catch (Unauthenticated $e) {
         $response = $this->redirector->guest($this->getLoginUrl($context));
     }
     $this->garbageCollect($this->securityContext->getSecurity($context), $this->securityContext->getConfigurationFor($context));
     return $response;
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if ($this->guard->guest()) {
         if ($request->ajax()) {
             return $this->response->make('Unauthorized.', 401);
         } else {
             if ($request->segment(1) === 'admin') {
                 return $this->redirect->guest('admin/login');
             } else {
                 return $this->redirect->guest('login');
             }
         }
     }
     return $next($request);
 }
Exemple #3
0
 /**
  * @param \Illuminate\Http\Request                 $request
  * @param \Illuminate\Auth\AuthenticationException $exception
  *
  * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
  */
 protected function unauthenticated($request, AuthenticationException $exception)
 {
     if ($request->expectsJson()) {
         return $this->response->json(['error' => 'Unauthenticated.'], 401);
     }
     return $this->redirector->guest('login');
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     $response = $this->security->check($this->guard->user());
     if ($response instanceof Response) {
         return $response;
     }
     if ($this->guard->guest()) {
         if ($request->ajax()) {
             return $this->response->make('Unauthorized.', 401);
         } else {
             if ($request->segment(1) === 'admin') {
                 return $this->redirect->guest('admin/login');
             } else {
                 return $this->redirect->guest('login');
             }
         }
     }
     return $next($request);
 }
Exemple #5
0
 /**
  * Create a new redirect response, while putting the current URL in the session.
  *
  * @param string $path
  * @param int $status
  * @param array $headers
  * @param bool $secure
  * @return \Illuminate\Http\RedirectResponse 
  * @static 
  */
 public static function guest($path, $status = 302, $headers = array(), $secure = null)
 {
     return \Illuminate\Routing\Redirector::guest($path, $status, $headers, $secure);
 }
 /**
  * Create a new redirect response, while putting the current URL in the session.
  *
  * @param  string  $path
  * @param  int     $status
  * @param  array   $headers
  * @param  bool    $secure
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function redirectGuest($path, $status = 302, $headers = array(), $secure = null)
 {
     return $this->redirector->guest($path, $status, $headers, $secure);
 }