Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

harilalmn's avatar

Route [login] not defined.

I have been following the Laravel series. Created a blog site as the lessons progressed, and I was on the topic of user authentication. Without loggin in, if I go to 127.0.0.1:8000/posts/create, it crashed saying Route [login] not defined. What am I doing wrong?

0 likes
2 replies
tykus's avatar

Do you have either of the following in your web route?

Auth::routes();

or

Route::get('login', 'Auth\LoginController')->name('login');

Your post/create route is protected by auth middleware, which redirects to a route named login if a Guest tries to POST to there.

2 likes

Please or to participate in this conversation.