fixed category and product route
This commit is contained in:
parent
fea082bb0b
commit
af91641ae4
|
|
@ -18,7 +18,7 @@ class CategoryList extends JsonResource
|
||||||
$item = [
|
$item = [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'name' => $this->description->name ?? '',
|
'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) {
|
if ($this->relationLoaded('children') && $this->children->count() > 0) {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class ProductList extends JsonResource
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'name' => $this->description->name ?? '',
|
'name' => $this->description->name ?? '',
|
||||||
'url' => url()->route('shop.products.show', ['product' => $this]),
|
'url' => shop_route('products.show', ['product' => $this]),
|
||||||
'price' => $this->price,
|
'price' => $this->price,
|
||||||
'image' => image_resize($this->image),
|
'image' => image_resize($this->image),
|
||||||
'price_format' => currency_format($this->price),
|
'price_format' => currency_format($this->price),
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,11 @@ class ShopServiceProvider extends ServiceProvider
|
||||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/shop.php');
|
$this->loadRoutesFrom(__DIR__ . '/../Routes/shop.php');
|
||||||
$this->mergeConfigFrom(__DIR__ . '/../../Config/beike.php', 'beike');
|
$this->mergeConfigFrom(__DIR__ . '/../../Config/beike.php', 'beike');
|
||||||
$this->loadSettings();
|
$this->loadSettings();
|
||||||
$this->loadShareView();
|
|
||||||
$this->registerGuard();
|
$this->registerGuard();
|
||||||
|
|
||||||
|
$this->app->booted(function () {
|
||||||
|
$this->loadShareView();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadSettings()
|
protected function loadSettings()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue