Admin pages throw error after changing the login route name for a non-logged-in user

I wanted to change the route URL and the login route name to some custom name and hence i made the changes in the “src/Illuminate/Routing/Router.php” file after line#1149.

image

But when i wanted to test the exception handling that occurs when a ‘non-logged-in’ user tries to access the admin/roles, and admin/permissions etc. pages, it shows the following error:

But the error stack doesn’t show in which file the [login] route is called or redirected. I’m unable to locate where route(‘login’) is being called.

Thanks in advance :smiley: :pray:

You are probably looking for this file: “app/Http/Middleware/Authenticate.php”

I checked the “app/Http/Middleware/Authenticate.php” file but this file has the updated name: customLoginName:

The routing is happening elsewhere i believe which is calling/redirecting the page to “route(‘login’)”.

Making changes to the “vendor” folder is not good practice. Because, then it is difficult to update the project with a composer.
I found the use of “route(‘login’)” in “src/Illuminate/Foundation/Exceptions/Handler.php” line 245.
In an ideal world, you should not modify files from the vendor folder.

1 Like

That really helped broaden my understanding. As you said, it’s adding several complications to the project and it’s best not to modify the vendor folder. Thanks a lot :open_mouth: :smiley: :pray: