You have to define the login route in the web.php.
Check more: https://laravel.com/docs/6.x/authentication
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey Guys,
I am writing a pure API implementation and i want to deny all routes that aren't done without the JSON format.
So far in my web route I have the following;
Route::any('{any}', function () {
abort(403, 'Unauthorized action.');
});
Which works fine for routes that dont exist in the api routes file.
But if I try and access /api/user from in the browser, I get a Route [login] not defined.
Is there a way I can set it so that if a user enters a valid API route in a web browser, or anywhere which doesnt send data in json format, it will return the same abort message as I have defined in the web file?
Please or to participate in this conversation.