1 public function authenticate(Request $request)
2 {
3 $request->validate([
4 'email' => 'required|string|email',
5 'password' => 'required|string',
6 ]);
7
8 $credentials = $request->only('email', 'password');
9
10 if (Auth::attempt($credentials)) {
11
12 return redirect('/');
13 }
14 return redirect('login')->with('error', 'Opps! You have entered invalid credentials');
15
16 }