I have this problems for a long time, I am using laravel 5.4 to develop a programs but i get stuck with this problem. When i try Login use Laravel make:auth to the web its redirect me to the /home and the menu in navbar is change correct? But when i push back button or i go to the index page in route '/' or "localhost:8000" the login and register menu is displaying again. Do you have some clue?
The code below is that you can see in the welcome.blade.php for fresh install of laravel 5.4
@if (Route::has('login'))
<div class="top-right links">
@if (Auth::check())
<a href="{{ url('/home') }}">Home</a>
@else
<a href="{{ url('/login') }}">Login</a>
<a href="{{ url('/register') }}">Register</a>
@endif
</div>
@endif
This code checks if a route named login exists firstly (which become added automatically when php artisan make:auth is used), then checks if a user is logged in, if so, it shows home menu otherwise login and register menu. You might be deleted these if statements.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.