简体   繁体   中英

laravel 5.4 menu login register still shown after login user

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?

After Login 登录后的页面

This is when i go to route 这是我去路线/

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM