Laravel Validation login
You could consider adding the trait AuthenticatesUsers
to your Controller:
class LoginController extends Controller { use \Illuminate\Foundation\Auth\AuthenticatesUsers; // <- add this line // ...}
Then you can throw your login
method and everything will work. More info here.
But if you want to build your own Authentication system (I don't recommend), you have to dig more. You could have a look here. Then update your controller like this:
public function login(Request $request){ $this->validate($request, [ 'email' => 'required|max:255|email', 'password' => 'required|confirmed', ]); if (Auth::attempt(['email' => $email, 'password' => $password])) { // Success return redirect()->intended('/panel'); } else { // Go back on error (or do what you want) return redirect()->back(); }}