Simple form
<form method="POST" action="/foo" > @csrf <input type="text" name="name"/><br/> <input type="submit" value="Add"/> </form> In routes \ web.php
Route::post('/foo', function () { echo '<pre>'; print_r($_POST); echo '<pre>'; return; When sending the form gives an error
419 Sorry, your session has expired. Please refresh and try again. In version 5.6 there was no such problem.
If in app / Http / Middleware / VerifyCsrfToken
prescribe
protected $except = [ '/foo', // ]; there is no check of the tokin that sends the form and the error does not appear.
The route works out and issues
Array ( [_token] => hnaGkZ6THI0pzVVlQD23jRRYQqIrQDtXGkK4ng2Z [name] => Саша ) The question is what settings need to be changed so that the VerifyCsrfToken intermediary automatically worked out the check. It turns out the token that the form submits does not receive the intermediary. Just take and turn off the route check in my opinion is not good.