Skip to content

Commit

Permalink
fix product check
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Feb 26, 2025
1 parent 84ae6d2 commit 9ae6ad4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Http/Resources/Api/V1/Shop/Catalog/CategoryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ public function toArray($request)
/* assign category */
$category = $this->category ? $this->category : $this;

$products = $category->products()->limit(10)->get();
// get products
$products = [];
if ($category->products_count > 0) {
$products = $category->products()->limit(10)->get();
}
// $products = $category->products()->limit(10)->get();


/* generating resource */
return [
Expand Down

0 comments on commit 9ae6ad4

Please sign in to comment.