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-03-23 20:38:03 +01:00
|
|
|
$account = Auth::user()->account;
|
|
|
|
$account->last_login = Carbon::now()->toDateTimeString();
|
|
|
|
$account->save();
|
2013-12-15 13:55:50 +01:00
|
|
|
|
2014-03-23 20:38:03 +01:00
|
|
|
Event::fire('user.refresh');
|
2013-12-15 13:55:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function onRefresh()
|
|
|
|
{
|
2014-01-06 19:03:00 +01:00
|
|
|
Auth::user()->account->loadLocalizationSettings();
|
2013-12-15 13:55:50 +01:00
|
|
|
}
|
|
|
|
}
|