laravel session logout not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raamay
    New Member
    • Feb 2007
    • 107

    laravel session logout not working

    I am using laravel inbuilt authentication but came across with the logout problem. Even after the logout i can go into dashboard. I tried flushing the session but it doesnt work. The middleware for the dashboard page is auth. Iam sure many have come across the cited bug .... kindly help me how to resolve it.

    app/Http/routes.php

    Code:
    Route::get('/', 'Auth\AuthController@getLogin');
    Route::post('/', 'Auth\AuthController@postLogin');
    home controller
    Code:
    <?php namespace App\Http\Controllers;
    use App\Http\Controllers\Controller;
    use Illuminate\Contracts\Auth\Guard;
    use Illuminate\Contracts\Auth\Registrar;
    use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
    use Illuminate\Support\Facades\Request;
    use Auth;
    
    class HomeController extends Controller {
    
    	/*
    	|--------------------------------------------------------------------------
    	| Home Controller
    	|--------------------------------------------------------------------------
    	|
    	| This controller renders your application's "dashboard" for users that
    	| are authenticated. Of course, you are free to change or remove the
    	| controller as you wish. It is just here to get your app started!
    	|
    	*/
    
    	/**
    	 * Create a new controller instance.
    	 *
    	 * @return void
    	 */
    	public function __construct()
    	{
    		$this->middleware('auth');
    	}
    
    	/**
    	 * Show the application dashboard to the user.
    	 *
    	 * @return Response
    	 */
    	public function index()
    	{
    		return view('home');
    	}
    
    }
    Illuminate/Foundation/Auth/AuthenticatesAn dRegistersUsers .php

    Code:
    /**
    	 * Log the user out of the application.
    	 *
    	 * @return \Illuminate\Http\Response
    	 */
    	public function getLogout()
    	{
    		//dd("Logging Out!!!");
    		$this->auth->logout();
    
    		Session::flush();
    
    		return redirect('/');
    	}
Working...