authenticate(); $request->session()->regenerate(); //Redirect admin and users to their panels $role = Auth::user()->role; if($role == 'user' || $role == 'vip'){ return redirect('/studio/index'); }elseif($role == 'admin'){ return redirect('/panel/index'); } return back(); } /** * Destroy an authenticated session. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse */ public function destroy(Request $request) { Auth::guard('web')->logout(); $request->session()->invalidate(); $request->session()->regenerateToken(); return redirect('/'); } }