I've tried almost every available solutions but can't solve the issue. Any solution to fix this error?
This is how I perform login and logout(Please correct me if the code is wrong as I'm new in laravel).
I've tried laravel-caffeine and {{ csrf_token() }}.
I think this is some session related issue.
public function auth(Request $request)
{
$this->validate($request, [
'email' => 'required|email|max:255',
'password' => 'required|min:6',
]);
$data = $request->only('email', 'password');
if (\Auth::attempt($data)) {
$email = $request->email;
$users = DB::table('users')
->where('email', $email)
->select('users.*', 'user_name')
->get();
Session::put('set', $users);
if ($users[0]->is_admin == '1') {
return redirect()->intended('adminDashboard');
}else{
return redirect()->intended('dashboard');
}
}else{
return back()->withInput()->witherrors(['Email or password did not match!']);
}
}
public function logout(){
Session::flush();
return view('login/login');
}
via ishan shah