Nael.Saeed's avatar

404.blade.php page user logged in issue

hello I have created a custom 404.blade.php page and placed it views\errors The problem now is that when the page shows up it shows the LOGIN button in the navbar though the user is already logged in and a logged in user navbar should show up instead. Also when I click on this LOGIN button it redirect me to /home because the user is already logged in though i had changed the redirectto in the login controller to be '/' instead of '/home'.

Any idea please ?

0 likes
2 replies
exorion's avatar

Can u put 404.blade.php here. I think the key inside

Nael.Saeed's avatar
Nael.Saeed
OP
Best Answer
Level 3

@exorion Hi, thanks for your reply. I found the solution in here:

https://laracasts.com/discuss/channels/laravel/getting-authuser-on-custom-404-page?page=2

Where it looks like the error page is not getting access to the session or whatever. but still looking for the answer that why the default Laravel app didn't do this modification? What bad is to happen after doing so.

now about the second issue if redirecting to /Home instead of / only though I changed the redirectTo to be / in the LoginController. I figured out that I need to manually do the change also in Middleware\redirectIfAuthenticated.php

1 like

Please or to participate in this conversation.