Disable CSRF protection for all routes In Laravel:
Remove or comment out this line in app\Http\Kernel.php
\App\Http\Middleware\VerifyCsrfToken::class,
To turn off or disable CRSF protection for some specific routes in Laravel :
open "app/Http/Middleware/VerifyCsrfToken.php
" file and add your routes in $except array
.
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'stripe/*',
'payment/verify/{id}/*',
'some/route/path',
];