Set the token on <head>
of your default.blade.php
.
<meta name="csrf-token" content="{{csrf_token()}}">
Add ajaxSetup
on the top of your script, that will be accessible to everywhere. This will set headers on each ajax
call
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});