diff --git a/app/Http/Controllers/Shop/CategoryController.php b/app/Http/Controllers/Shop/CategoryController.php index 7d79318d..91bd26e9 100644 --- a/app/Http/Controllers/Shop/CategoryController.php +++ b/app/Http/Controllers/Shop/CategoryController.php @@ -25,8 +25,6 @@ class CategoryController extends Controller $data['category'] = Categories::getFull($category_id); $data['articles'] = Articles::getArticlesToSell($category_id); $data['tags'] = TagGroups::getWithTagsAndCountOffers(); - // dump($data); - // exit; return view('Shop.shelve', $data); } diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php index cbd135e8..65b871d9 100644 --- a/app/Repositories/Shop/Articles.php +++ b/app/Repositories/Shop/Articles.php @@ -90,7 +90,7 @@ class Articles } // dump($data); // exit; - return $data; + return $data ?? false; } public static function getArticlesWithOffers($category_id = false, $tags = false) diff --git a/resources/views/Shop/layout/partials/category_add.blade.php b/resources/views/Shop/layout/partials/category_add.blade.php index 9698df72..1e3cbf2f 100644 --- a/resources/views/Shop/layout/partials/category_add.blade.php +++ b/resources/views/Shop/layout/partials/category_add.blade.php @@ -15,7 +15,7 @@
- Il y a {{ count($articles) ?? 0 }} article(s) dans la liste + Il y a {{ $articles ? count($articles) : 0 }} article(s) dans la liste
diff --git a/resources/views/Shop/layout/partials/category_articles.blade.php b/resources/views/Shop/layout/partials/category_articles.blade.php index 3d8a5f90..d06d60f2 100644 --- a/resources/views/Shop/layout/partials/category_articles.blade.php +++ b/resources/views/Shop/layout/partials/category_articles.blade.php @@ -1,7 +1,9 @@
- @foreach ($articles as $product_name => $article) -
- @include('Shop.Articles.partials.article') -
- @endforeach + @if ($articles) + @foreach ($articles as $product_name => $article) +
+ @include('Shop.Articles.partials.article') +
+ @endforeach + @endif
\ No newline at end of file diff --git a/resources/views/Shop/layout/partials/category_articles_rows.blade.php b/resources/views/Shop/layout/partials/category_articles_rows.blade.php index 2f62a185..a420694a 100644 --- a/resources/views/Shop/layout/partials/category_articles_rows.blade.php +++ b/resources/views/Shop/layout/partials/category_articles_rows.blade.php @@ -1,3 +1,5 @@ -@foreach ($articles as $product_name => $article) - @include('Shop.Articles.partials.article_rows') -@endforeach +@if ($articles) + @foreach ($articles as $product_name => $article) + @include('Shop.Articles.partials.article_rows') + @endforeach +@endif \ No newline at end of file