catchAdmin/extend/catcher/event/LoadModuleRoutes.php

38 lines
663 B
PHP
Raw Normal View History

2019-12-06 09:17:40 +08:00
<?php
declare (strict_types = 1);
namespace catcher\event;
use catcher\CatchAdmin;
use think\Route;
class LoadModuleRoutes
{
/**
* 处理
*
* @time 2019年11月29日
* @return void
*/
public function handle(): void
{
$router = app(Route::class);
$router->group(function () use ($router) {
2019-12-14 18:21:29 +08:00
foreach ($this->getRoutes() as $route) {
include $route;
}
2019-12-06 09:17:40 +08:00
});
}
2019-12-14 18:21:29 +08:00
protected function getRoutes()
{
return [
CatchAdmin::directory() . 'login' . DIRECTORY_SEPARATOR . 'route.php',
CatchAdmin::getRoutes(),
];
}
2019-12-06 09:17:40 +08:00
}