Rohullah Rajaee Rad
Rohullah Rajaee Rad

Reputation: 581

How To Disable CSRF Protection For All Routes In Laravel5

Is there any way in Laravel 5.2 to disable csrf protection for all routes without using VerifyCsrfToken middelware and $except[] array?

Upvotes: 3

Views: 5701

Answers (2)

Amit Gupta
Amit Gupta

Reputation: 17658

In your App\Http\Middleware\VerifyCsrfToken class add the following code:

protected $except = [
    '*',
];

Docs

Upvotes: 10

Alexey Mezenin
Alexey Mezenin

Reputation: 163748

Remove or comment out this line in app\Http\Kernel.php:

\App\Http\Middleware\VerifyCsrfToken::class,

Upvotes: 9

Related Questions