@domenico
To solve the "419 csrf token error" in Laravel, you can try the following solutions:
1 2 3 4 |
<form method="POST" action="/your-route">
@csrf
<!-- your form fields go here -->
</form>
|
1 2 3 4 5 6 7 8 |
'web' => [
AppHttpMiddlewareEncryptCookies::class,
IlluminateCookieMiddlewareAddQueuedCookiesToResponse::class,
IlluminateSessionMiddlewareStartSession::class,
IlluminateViewMiddlewareShareErrorsFromSession::class,
AppHttpMiddlewareVerifyCsrfToken::class,
IlluminateRoutingMiddlewareSubstituteBindings::class,
],
|
1 2 3 4 5 |
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
|
By following these steps, you should be able to resolve the "419 csrf token error" in Laravel.