Add a new event on login - backend.user.login

I wanted to listen to an event when a users logs-in in the backend and I realised that October does not yet have that. It would be great to support this out of the box to avoid users make changes to core files or listen to hack-ish events to do something after login.
This commit is contained in:
Filip Iulian Pacurar 2016-02-13 12:46:51 +02:00
parent fade9413d9
commit 1ab94d4514
1 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,7 @@
use Mail;
use Backend;
use October\Rain\Auth\Models\User as UserBase;
use Event;
/**
* Administrator user model
@ -108,6 +109,12 @@ class User extends UserBase
}
}
public function afterLogin()
{
Event::fire('backend.user.login', [$this]);
parent::afterLogin();
}
public function sendInvitation()
{
$data = [