fixed url for category and product

This commit is contained in:
Edward Yang 2022-06-23 16:28:51 +08:00
parent b394063f0f
commit 1b07e010f8
2 changed files with 2 additions and 0 deletions

View File

@ -18,6 +18,7 @@ class CategoryList extends JsonResource
$item = [
'id' => $this->id,
'name' => $this->description->name ?? '',
'url' => url()->route('shop.categories.show', ['category' => $this])
];
if ($this->relationLoaded('children') && $this->children->count() > 0) {

View File

@ -20,6 +20,7 @@ class ProductList extends JsonResource
return [
'id' => $this->id,
'name' => $this->description->name ?? '',
'url' => url()->route('shop.products.show', ['product' => $this]),
'price' => $this->price,
'image' => image_resize($this->image),
'price_format' => currency_format($this->price),