只有已启用插件才能执行 route 和 middleware
This commit is contained in:
parent
76e45fd16e
commit
4d6c89cf6c
|
|
@ -156,6 +156,7 @@ class DesignService
|
||||||
private static function handleRichText($content): array
|
private static function handleRichText($content): array
|
||||||
{
|
{
|
||||||
$content['data'] = $content['text'][locale()] ?? '';
|
$content['data'] = $content['text'][locale()] ?? '';
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,17 +45,18 @@ class PluginServiceProvider extends ServiceProvider
|
||||||
$this->pluginBasePath = base_path('plugins');
|
$this->pluginBasePath = base_path('plugins');
|
||||||
|
|
||||||
foreach ($plugins as $plugin) {
|
foreach ($plugins as $plugin) {
|
||||||
|
$pluginCode = $plugin->getDirname();
|
||||||
$this->bootPlugin($plugin);
|
$this->bootPlugin($plugin);
|
||||||
|
$this->registerRoutes($pluginCode);
|
||||||
|
$this->registerMiddleware($pluginCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
$allPlugins = $manager->getPlugins();
|
$allPlugins = $manager->getPlugins();
|
||||||
foreach ($allPlugins as $plugin) {
|
foreach ($allPlugins as $plugin) {
|
||||||
$pluginCode = $plugin->getDirname();
|
$pluginCode = $plugin->getDirname();
|
||||||
$this->loadMigrations($pluginCode);
|
$this->loadMigrations($pluginCode);
|
||||||
$this->loadRoutes($pluginCode);
|
|
||||||
$this->loadViews($pluginCode);
|
$this->loadViews($pluginCode);
|
||||||
$this->loadTranslations($pluginCode);
|
$this->loadTranslations($pluginCode);
|
||||||
$this->registerMiddleware($pluginCode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,11 +91,11 @@ class PluginServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载插件路由
|
* 加载插件路由并注册
|
||||||
*
|
*
|
||||||
* @param $pluginCode
|
* @param $pluginCode
|
||||||
*/
|
*/
|
||||||
private function loadRoutes($pluginCode)
|
private function registerRoutes($pluginCode)
|
||||||
{
|
{
|
||||||
$pluginBasePath = $this->pluginBasePath;
|
$pluginBasePath = $this->pluginBasePath;
|
||||||
$shopRoutePath = "{$pluginBasePath}/{$pluginCode}/Routes/shop.php";
|
$shopRoutePath = "{$pluginBasePath}/{$pluginCode}/Routes/shop.php";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue