2013-12-15 13:55:50 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class UserEventHandler
|
|
|
|
{
|
|
|
|
public function subscribe($events)
|
|
|
|
{
|
|
|
|
$events->listen('user.signup', 'UserEventHandler@onSignup');
|
|
|
|
$events->listen('user.login', 'UserEventHandler@onLogin');
|
|
|
|
|
|
|
|
$events->listen('user.refresh', 'UserEventHandler@onRefresh');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function onSignup()
|
|
|
|
{
|
2014-01-30 23:29:09 +01:00
|
|
|
|
2013-12-15 13:55:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function onLogin()
|
|
|
|
{
|
2014-01-06 19:03:00 +01:00
|
|
|
$account = Auth::user()->account;
|
2013-12-15 13:55:50 +01:00
|
|
|
$account->last_login = Carbon::now()->toDateTimeString();
|
|
|
|
$account->save();
|
|
|
|
|
|
|
|
Event::fire('user.refresh');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function onRefresh()
|
|
|
|
{
|
2014-01-06 19:03:00 +01:00
|
|
|
Auth::user()->account->loadLocalizationSettings();
|
2013-12-15 13:55:50 +01:00
|
|
|
}
|
|
|
|
}
|