SANJISH's avatar

Route::has meaning

Hello All, I am new to Laravel 8 and cant understand meaning of @if(Route::has('login')). It passes this condition even though my web.php has no Route for Login. My web.php is like

0 likes
7 replies
SilenceBringer's avatar

@sanjish as you can imagine, Route::has checks named route existance.

So, if you have login route defined - it will display the Login button with the link to your login page

If it's not - the Login button will not be displayed

2 likes
SilenceBringer's avatar

@SANJISH this way it just will not render the login button.

As far as you use ui preset (breeeze/jetstream or something) you have all available options by default (but with appropriate conditions). Just remove it if you do not need it

or add login route - and it will be rendered

1 like
folium's avatar
folium
Best Answer
Level 3

@sanjish it's because you have installed the Laravel authentication using Laravel UI/Breeze/Jetstream. Kindly Check the route list by performing below command in your terminal you will probably get idea about it..

php artisan route:list
1 like
SANJISH's avatar

Thanks Folium, It is in Vendor/Laravel/Fortify/routes/routes.php even though php artisan routes:list does not specify this path.

1 like
dgloria's avatar

Is this in the api.php or in the web.php? Does the login work at all, or is it just mock?

Please or to participate in this conversation.