I am creating a plugin for october and need to write some functionality on backend user logout.
I have seen that there is a event for user login which words perfectly.
Event::listen('backend.user.login', function($user) {
//Code Here
});
I have gone through the documentation and was unable to find any such event.
Is there any similar event for logout? If not how can I achieve this.?
If you study the logout link for backend users you will find that it directs to a page (/backend/backend/auth/signout).
The following code is tested and works (place inside your own Plugin.php):
(...)
use Backend\Controllers\Auth;
class Plugin extends PluginBase
{
public $elevated = true;// important
public function boot()
{
Auth::extend(function ($controller) {
$controller->bindEvent('page.beforeDisplay', function ($action, $params) use ($controller) {
if ($action === 'signout') {
Log::info('signing out...');
}
});
});
}
(...)
Last updated
1-2 of 2
You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.