Skip to content

Instantly share code, notes, and snippets.

@localdisk
Created January 10, 2014 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save localdisk/8346366 to your computer and use it in GitHub Desktop.
Save localdisk/8346366 to your computer and use it in GitHub Desktop.
Laravel 4 CSRF on all POST requests
<?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