What about using events like so:
Event::listen('auth.login', function($user)
{
$user->login_at = new DateTime;
$user->save();
});
Thanks for your reply. This would indeed be the most logical approach.
However, the 'auth.login' doesn't fire when authenticating via cookie, right?
Event::listen('auth.login', function($user)
{
if(Auth::viaRemember())
{
$event = Event::fire('auth.cookieLogin', array($user));
}
// don't return false here unless you want to stop propagation of the other auth.login event listener.
});
Event::listen('auth.cookieLogin', function($user)
{
// do something and/or return something.
});
Thanks! Unfortunately it seems to be a dead end, because the 'auth.login' event does not fire at all. The guy in the Stack Overflow topic seems to be unsuccessful as well.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community