Laravel - Authentication
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.
page revision: 0, last edited: 22 Oct 2016 08:35