use App\Models\Application;
use App\Models\Page;
use Cubist\Backpack\app\Magic\PageData;
+use Cubist\Backpack\Facades\App;
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',
]);
}
// 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();
}