diff --git a/beike/Shop/Providers/PluginServiceProvider.php b/beike/Shop/Providers/PluginServiceProvider.php index 00a1234d..de2ce177 100644 --- a/beike/Shop/Providers/PluginServiceProvider.php +++ b/beike/Shop/Providers/PluginServiceProvider.php @@ -94,22 +94,24 @@ class PluginServiceProvider extends ServiceProvider } /** - * 加载插件路由并注册 + * Load and register for admin and shop * * @param $pluginCode */ private function registerRoutes($pluginCode) { - $pluginBasePath = $this->pluginBasePath; - $shopRoutePath = "{$pluginBasePath}/{$pluginCode}/Routes/shop.php"; - if (file_exists($shopRoutePath)) { - Route::name('shop.') - ->middleware('shop') - ->group(function () use ($shopRoutePath) { - $this->loadRoutesFrom($shopRoutePath); - }); - } + $this->registerAdminRoutes($pluginCode); + $this->registerShopRoutes($pluginCode); + } + /** + * Register admin routes + * + * @param $pluginCode + */ + private function registerAdminRoutes($pluginCode) + { + $pluginBasePath = $this->pluginBasePath; $adminRoutePath = "{$pluginBasePath}/{$pluginCode}/Routes/admin.php"; if (file_exists($adminRoutePath)) { $adminName = admin_name(); @@ -122,6 +124,24 @@ class PluginServiceProvider extends ServiceProvider } } + /** + * Register shop routes + * + * @param $pluginCode + */ + private function registerShopRoutes($pluginCode) + { + $pluginBasePath = $this->pluginBasePath; + $shopRoutePath = "{$pluginBasePath}/{$pluginCode}/Routes/shop.php"; + if (file_exists($shopRoutePath)) { + Route::name('shop.') + ->middleware('shop') + ->group(function () use ($shopRoutePath) { + $this->loadRoutesFrom($shopRoutePath); + }); + } + } + /** * 加载多语言 */