php Illuminate-Foundation-Http-Middleware-VerifyCsrfToken类(方法)实例源码

下面列出了php Illuminate-Foundation-Http-Middleware-VerifyCsrfToken 类(方法)源码代码实例,从而了解它的用法。

作者:deade    项目:dje   
public function handle($request, \Closure $next)
 {
     try {
         return parent::handle($request, $next);
     } catch (TokenMismatchException $e) {
         return $this->unauthorizedResponse();
     }
 }

作者:bilel9    项目:tetris_webservic   
/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!\Request::is('ws/*') && !\Request::ajax()) {
         return parent::handle($request, $next);
     }
     return $this->addCookieToResponse($request, $next($request));
 }

作者:berkapave    项目:Laravel5-Time-Tracker-Project-manage   
/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ('testing' !== app()->environment()) {
         return parent::handle($request, $next);
     }
     return $next($request);
 }

作者:hongpy    项目:l5essentia   
/**
  * {@inheritDoc}
  */
 public function handle($request, Closure $next)
 {
     if (is_api_request()) {
         return $this->addCookieToResponse($request, $next($request));
     }
     return parent::handle($request, $next);
 }

作者:Rhincodo    项目:test-larave   
protected function tokensMatch($request)
 {
     if ($request->wantsJson()) {
         return true;
     }
     return parent::tokensMatch($request);
 }

作者:Insantan    项目:SourceTree-diov   
public function handle($request, Closure $next)
 {
     if (!$request->is("api/*")) {
         return parent::handle($request, $next);
     }
     return $next($request);
 }

作者:BePsvP    项目:CC   
/**
  * Add the CSRF token to the response cookies.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Illuminate\Http\Response  $response
  * @return \Illuminate\Http\Response
  */
 protected function addCookieToResponse($request, $response)
 {
     if ('array' !== config('session.driver')) {
         return parent::addCookieToResponse($request, $response);
     }
     return $response;
 }

作者:MetropoliaUA    项目:ISDProject-Onlin   
protected function shouldPassThrough($request)
 {
     if ($request->is('login') && $request->ajax()) {
         return true;
     }
     return parent::shouldPassThrough($request);
 }

作者:linuxss    项目:l5essentia   
/**
  * {@inheritDoc}
  */
 public function handle($request, Closure $next)
 {
     if (is_api_request()) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }

作者:deviseph    项目:cm   
/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->shouldIgnore($request)) {
         return $this->addCookieToResponse($request, $next($request));
     }
     return parent::handle($request, $next);
 }

作者:Houbs    项目:Websit   
/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->getRequestUri() == '/en/update/docs') {
         return $next($request);
     }
     return parent::handle($request, $next);
 }

作者:lanhongji    项目:todoAp   
/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->method() == 'POST') {
         return $next($request);
     }
     return parent::handle($request, $next);
 }

作者:hlmasterchie    项目:ploc   
/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (\App::environment() == 'testing') {
         return $next($request);
     }
     return parent::handle($request, $next);
 }

作者:RobinJ199    项目:VacStatu   
/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $userKey = $request->input('_key');
     if ($userKey && !empty($userKey)) {
         $user = User::where('user_key', $userKey)->first();
         if (Auth::check()) {
             $prevuser = Auth::user();
             Auth::logout();
         }
         if ($user->exists()) {
             Auth::login($user);
             $response = $next($request);
             Auth::logout();
             if (isset($prevuser) && isset($prevuser->id)) {
                 Auth::login($prevuser);
             }
             return $response;
         } else {
             $response = $next($request);
         }
         if (isset($prevuser)) {
             Auth::login($prevuser);
         }
         return $response;
     }
     if ($request->is('api/v1/donate/ipn')) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }

作者:keiwerkgv    项目:salesperformanceindicato   
/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (strpos($request, 'infusion')) {
         return $this->addCookieToResponse($request, $next($request));
     }
     return parent::handle($request, $next);
 }

作者:rosemalejoh    项目:dnsc-hri   
public function handle($request, Closure $next)
 {
     if ($request->ajax()) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }

作者:janusni    项目:imgubo   
/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (strpos($request->getRequestUri(), 'queue') >= 0) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }

作者:x30359731    项目:inspire   
/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->is('admin/upload')) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }

作者:jenk    项目:muzi   
/**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request instanceof Request) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }

作者:Gladd    项目:clipshare-ol   
public function handle($request, Closure $next)
 {
     if (in_array($request->path(), $this->openRoutes)) {
         return $next($request);
     } else {
         return parent::handle($request, $next);
     }
 }


问题


面经


文章

微信
公众号

扫码关注公众号