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:
parent
fade9413d9
commit
1ab94d4514
|
|
@ -3,6 +3,7 @@
|
|||
use Mail;
|
||||
use Backend;
|
||||
use October\Rain\Auth\Models\User as UserBase;
|
||||
use Event;
|
||||
|
||||
/**
|
||||
* Administrator user model
|
||||
|
|
@ -107,6 +108,12 @@ class User extends UserBase
|
|||
$this->sendInvitation();
|
||||
}
|
||||
}
|
||||
|
||||
public function afterLogin()
|
||||
{
|
||||
Event::fire('backend.user.login', [$this]);
|
||||
parent::afterLogin();
|
||||
}
|
||||
|
||||
public function sendInvitation()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue