ilakkiya
ilakkiya

Reputation: 3

Logout not working in laravel5

It does not destroy the session after logout I able to see the dashboard.How to use Auth mechanism in my View controller

Controller

public function admin_logout()
{
    Session::forget('userid');
    Session::forget('username');
    Session::flush();
    Auth::logout();
    return Redirect('siteadmin');
}

Model

 public static function login_check($uname,$password)
    {
        $check = DB::table('le_admin')->where('adm_email','=',$uname)->where('adm_password','=',$password)->get();
    if($check)
    {
        Session::put('userid', $check[0]->adm_id);
        Session::put('username', $check[0]->adm_email);
        return 1;

    }
    else
    {
        return 0;
    }
}

Upvotes: 0

Views: 97

Answers (2)

vikram mistry
vikram mistry

Reputation: 106

Here is the complete documention for authentication. Just try to use the Auth facades to accomplish your task.

http://laravel.com/docs/5.1/authentication

You only need to use manual authentication - the rest of the things will be taken care by the Laravel in the background.

Upvotes: 0

Marcin Nabiałek
Marcin Nabiałek

Reputation: 111839

You should use:

Auth::logout()

to make sure user is logged out.

Reference: http://laravel.com/docs/5.1/authentication#authenticating-users

Upvotes: 3

Related Questions