My logout link is not working from the navigation bar; however, if I add the link on the home page, or if I go directly to the route (http://localhost/dico/public/logout) it works and the user is logged out.
When I review the page source code, I confirmed the href in the logout link is correct. If I click on the link from the source code, the 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 also tried
Logout