Created
January 10, 2014 03:07
-
-
Save localdisk/8346366 to your computer and use it in GitHub Desktop.
Laravel 4 CSRF on all POST requests
This file contains 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 | |
App::before(function($request) | |
{ | |
// POST / PUT / DELETE / PATCH also included You can use the $request-> getRealMethod() | |
if ($request->getMethod() === 'POST') { | |
Route::callRouteFilter('csrf', [], '', $request); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment