From: Vincent Vanwaelscappel Date: Mon, 14 Feb 2022 09:33:40 +0000 (+0100) Subject: wait #5083 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=90f8e2c80ee379a7b910063081e0657db689c9b4;p=pmi.git wait #5083 @0.25 --- diff --git a/app/Templates/CategoryListing.php b/app/Templates/CategoryListing.php index b349515..6e1890f 100644 --- a/app/Templates/CategoryListing.php +++ b/app/Templates/CategoryListing.php @@ -6,6 +6,7 @@ namespace App\Templates; use App\Models\Application; use App\Models\Page; use Cubist\Backpack\app\Magic\PageData; +use Cubist\Backpack\Facades\App; class CategoryListing extends Base { @@ -28,12 +29,12 @@ class CategoryListing extends Base ]); $this->addField(['name' => 'related_applications', - 'label' => 'Applications associées', - 'type' => 'SelectFromModel', - 'optionsmodel' => Application::class, - 'multiple' => true, - 'attribute' => 'title', - 'tab' => 'Applications Associées', + 'label' => 'Applications associées', + 'type' => 'SelectFromModel', + 'optionsmodel' => Application::class, + 'multiple' => true, + 'attribute' => 'title', + 'tab' => 'Applications Associées', ]); } @@ -45,14 +46,20 @@ class CategoryListing extends Base // These will be used to populate the grid of sub-categories $current_page_ID = $data['page']->id; $categories = Page::with('media') - ->where('parent_id', $current_page_ID) - ->where('template', 'category') - ->orderBy('lft') - ->get(); + ->where('parent_id', $current_page_ID) + ->where('template', 'category') + ->orderBy('lft') + ->get(); $data['categories'] = []; foreach ($categories as $category) { + if (!$category->getAttribute('status')) { + continue; + } + if (!in_array(App::getVariant(), $category->getAttribute('variant'))) { + continue; + } $data['categories'][$category->id] = $category->getPageData(); }