diff --git a/beike/Shop/Http/Resources/CategoryList.php b/beike/Shop/Http/Resources/CategoryList.php index d9631790..8c9ce8a5 100644 --- a/beike/Shop/Http/Resources/CategoryList.php +++ b/beike/Shop/Http/Resources/CategoryList.php @@ -18,7 +18,7 @@ class CategoryList extends JsonResource $item = [ 'id' => $this->id, 'name' => $this->description->name ?? '', - // 'url' => url()->route('shop.categories.show', ['category' => $this]) + 'url' => shop_route('categories.show', ['category' => $this]) ]; if ($this->relationLoaded('children') && $this->children->count() > 0) { diff --git a/beike/Shop/Http/Resources/ProductList.php b/beike/Shop/Http/Resources/ProductList.php index 1c645ab0..cccec462 100644 --- a/beike/Shop/Http/Resources/ProductList.php +++ b/beike/Shop/Http/Resources/ProductList.php @@ -20,7 +20,7 @@ class ProductList extends JsonResource return [ 'id' => $this->id, 'name' => $this->description->name ?? '', - 'url' => url()->route('shop.products.show', ['product' => $this]), + 'url' => shop_route('products.show', ['product' => $this]), 'price' => $this->price, 'image' => image_resize($this->image), 'price_format' => currency_format($this->price), diff --git a/beike/Shop/Providers/ShopServiceProvider.php b/beike/Shop/Providers/ShopServiceProvider.php index bb293281..c92212f8 100644 --- a/beike/Shop/Providers/ShopServiceProvider.php +++ b/beike/Shop/Providers/ShopServiceProvider.php @@ -23,8 +23,11 @@ class ShopServiceProvider extends ServiceProvider $this->loadRoutesFrom(__DIR__ . '/../Routes/shop.php'); $this->mergeConfigFrom(__DIR__ . '/../../Config/beike.php', 'beike'); $this->loadSettings(); - $this->loadShareView(); $this->registerGuard(); + + $this->app->booted(function () { + $this->loadShareView(); + }); } protected function loadSettings() @@ -49,7 +52,7 @@ class ShopServiceProvider extends ServiceProvider protected function registerGuard() { - Config::set('auth.guards.'.Customer::AUTH_GUARD, [ + Config::set('auth.guards.' . Customer::AUTH_GUARD, [ 'driver' => 'session', 'provider' => 'shop_customer', ]);