xxxxxxxxxx
Laravel ajax solution:
1. "_token": "{{ csrf_token() }}",
2. headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
3.$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
xxxxxxxxxx
//Go to app/Http/Middleware/VerifyCsrfToken.php and add this values
protected $except = [
'/api/*'
];
xxxxxxxxxx
<input type="hidden" name="_token" id="token" value="{{ csrf_token() }}">