注册事件
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
<?php
|
||||
namespace catchAdmin;
|
||||
|
||||
use catchAdmin\login\LoginLogListener;
|
||||
use catchAdmin\permissions\OperateLogListener;
|
||||
use catchAdmin\permissions\PermissionsMiddleware;
|
||||
use catchAdmin\system\event\LoginLogEvent;
|
||||
use catchAdmin\system\event\OperateLogEvent;
|
||||
use catcher\command\InstallCommand;
|
||||
use catcher\command\MigrateRunCommand;
|
||||
use catcher\command\ModelGeneratorCommand;
|
||||
@@ -30,6 +34,8 @@ class CatchAdminService extends Service
|
||||
|
||||
$this->registerValidates();
|
||||
$this->registerMiddleWares();
|
||||
$this->registerEvents();
|
||||
$this->registerListeners();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,4 +67,38 @@ class CatchAdminService extends Service
|
||||
'check_auth' => PermissionsMiddleware::class
|
||||
], 'route');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @time 2019年12月12日
|
||||
* @return void
|
||||
*/
|
||||
protected function registerEvents(): void
|
||||
{
|
||||
$this->app->event->bind([
|
||||
'loginLog' => LoginLogEvent::class,
|
||||
'operateLog' => OperateLogEvent::class,
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册监听者
|
||||
*
|
||||
* @time 2019年12月12日
|
||||
* @return void
|
||||
*/
|
||||
protected function registerListeners(): void
|
||||
{
|
||||
$this->app->event->listenEvents([
|
||||
'loginLog' => [
|
||||
LoginLogListener::class,
|
||||
],
|
||||
'operateLog' => [
|
||||
OperateLogListener::class,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user