Last active
October 19, 2017 13:59
-
-
Save zabaala/a94ddc76439689c4706e3181a34ec8e6 to your computer and use it in GitHub Desktop.
Override Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Handle an incoming request. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \Closure $next | |
* @return mixed | |
* | |
*/ | |
public function handle($request, Closure $next) | |
{ | |
if ($this->isReading($request) || | |
$this->runningUnitTests() || | |
$this->shouldPassThrough($request) || | |
$this->tokensMatch($request) | |
) { | |
return $this->addCookieToResponse($request, $next($request)); | |
} | |
return redirect()->back() | |
->with('custom_error', 'Sorry. For security reason, reload this page and try submit the form again.'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment