A
A
Abc Edc2015-10-08 08:23:45
Laravel
Abc Edc, 2015-10-08 08:23:45

How to throw different errors on tokenMismatchException?

Found an interesting way to catch this exception. I wanted to process it by throwing it on login, because it usually pops up when it gets cold. But if you poke for a long time on the submit form, so that the token does not have time to get into shape, I mean, it did not have time to load. How can I issue a different error in this situation?:

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2015-10-08
@gleber1

If the token did not have time to load into the form (it’s hard to believe in this, to be honest), it means that a request came to the server in which there is no token at all. So check this fact in App\Http\MiddlewareVerifyCsrfToken.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question