xxxxxxxxxx
//app/http/middleware/VerifyCsrfToken.php
protected $except = [ 'api/*'];
xxxxxxxxxx
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'stripe/*',
'http://example.com/foo/bar',
'http://example.com/foo/*',
];
}
xxxxxxxxxx
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'stripe/*',
'user/ProcessPayment',
'api/route/one',
'api/route/two'
];
}
xxxxxxxxxx
Disable CSRF on few routes by editing.
App\Http\Middleware\VerifyCsrfToken.php
and add your own routes name in protected
$except = ['user/ProcessPayment'] array.