Laravel - Authentication

laravel

How can we use the authentication mechanism provided by Laravel?

Modify the User model to implements the Authenticable interface:

class User extends Model implements Authenticable {
  use \Illuminate\Auth\Authenticable;
}
if (Auth::attempt(['email' => $request['email'], 'password' => $request['password']])) {
  return redirect()->route('dashboard');
} else {
  return redirect()->back();
}
Auth::login($user);

where $user is the model object that we just saved to the database.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License