Laravel 4 CSRF on all POST requests

Submitted by localdisk - 5 years ago

Laravel 4 CSRF on all POST requests

App::before(function($request)
{
    // POST / PUT / DELETE / PATCH also included You can use the $request-> getRealMethod()
    if ($request->getMethod() === 'POST') {
        Route::callRouteFilter('csrf', [], '', $request);
    }
});