Laravel giving the session error when trying to login from multiple account

Viewed 534

I have user table that have three types of user, Admin, storemanager, user with type values in user table is 1,2 for admin and storemanager. The login and the logout is easily running for one type of user. But when i try to login from another account by logging out from the first account it gives the error...... Argument 1 passed to Illuminate\Session\Middleware\StartSession::addCookieToResponse() must be an instance of Symfony\Component\HttpFoundation\Response, instance of Illuminate\View\View given, called in C:\xampp\htdocs\loyaty\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php on line 70 error comes first time only second time it runs perfectly Here is my login controller code

public function login_post(Request $request)
{

    if (
        Auth::attempt([
            'email' => $request->email,
            'password' => $request->password,
            'user_type' => 1
        ],true) ||
        Auth::attempt([
            'email' => $request->email,
            'password' => $request->password,
            'user_type' => 2
        ],true)
    ) {            
        return redirect('admin/dashboard');
    } else {
        Session::flash('message', 'Invalid email and password');
    }

    return view('admin.login.index');
}

//for logout
public function logout(Request $request) {
    Auth::logout();
    return redirect('/admin_login');
}

Please help to resolve the problem..

0 Answers
Related