jeudi 31 décembre 2015

Laravel 5.2 Auth::guest cant work

 @if (Auth::guest())
                    <li><a href="{{ url('/login') }}">Login</a></li>
                    <li><a href="{{ url('/register') }}">Register</a></li>
                @else
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                            {{ Auth::user()->name }} <span class="caret"></span>
                        </a>

                        <ul class="dropdown-menu" role="menu">
                            <li><a href="{{ url('/logout') }}"><i class="fa fa-btn fa-sign-out"></i>Logout</a></li>
                        </ul>
                    </li>
                @endif

This is the autogenerate code after i run the command : php artisan make:auth After it generate the file and i set up for the database, it can let me to register and login. But it cant show the logout button after i login or register. The code above is checking the session have any user or not. If that is no user login, then it will come out the login and register button on the right of website. Like this:Default of the main page -

Main Page


But everything is remain same, and i could find out what is the wrong part.Auth::check() Auth::user() this two i already try, and it still didnt works. Anyone one have the solution?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire