$.ajax({
headers: {
'X-CSRF-TOKEN': "{{csrf_token()}}",
},
url : "{{route('')}}",
type : "GET",
success : function(response){
}
});
<head>
<meta name="csrf-token" content="{{ csrf_token() }}" />
</head>
<meta name="csrf-token" content="{{ csrf_token() }}" />
<script type="text/javascript">
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
</script>
{{ csrf_token() }}
{{ csrf_field() }}
"_token": "{{ csrf_token() }}",
<form method="POST" action="/profile">
@csrf
<input name="name">
<button type="submit">send</button>
</form>
//In laravel 7. Open file AppHttpMiddlewareVerifyCsrfToken.php
//Disable for all routes
protected $except = [
'*',
];
//Disable for some routes
protected $except = [
'mobile/*',
'news/articles',
];
//I searched for a long time how to disable CSRF completely,
//there are many identical examples but they do not help
"_token": "{{ csrf_token() }}",