php - logout link not working when on nav bar using laravel -
my logout link not working navigation bar; however, if add link on home page, or if go directly route (http://localhost/dico/public/logout) works , user logged out.
when review page source code, confirmed href in logout link correct. if click on link source code, user gets logged out.
route
route::get('logout', 'sessionscontroller@destroy');
controller
<?php namespace app\http\controllers; use illuminate\http\request; class sessionscontroller extends controller { public function __construct() {...} public function create() {...} public function store() {...} public function destroy() { auth()->logout(); return redirect('/login'); } }
the view
<li><a href="{{ url::to('logout') }}"><i class="fa fa-sign-out fa-fw"></i> logout</a></li>
i tried
you should try may you:
need change
<li><a href="{{ url::to('logout') }}"><i class="fa fa-sign-out fa-fw"></i> logout</a></li>
to
<li><a href="{{ url('logout') }}"><i class="fa fa-sign-out fa-fw"></i> logout</a></li>
or
<a href="{{ url('logout') }}">logout</a>
hope work !!!
Comments
Post a Comment