, type: string, link: string}> */ private function getCommitmentModels(): Collection { return StaticPage::getCachedCommitmentsStaticPages() ->map(fn ($page) => [ 'title' => $page->type->label(), 'picto' => $page->data['picto_navigation'] ?? null, 'activePicto' => $page->data['picto_banner'] ?? null, 'type' => $page->type->value, 'link' => route($page->type->routeForCommitments()), ]) ->filter(fn ($item) => ! empty($item['picto']['value'])) ->values(); } /** * Render a commitment page view with its static page model and navigation models. * * @param StaticPageType $type The commitment page type to load. * @param string $view The fully qualified Blade view name to render. */ private function renderPage(StaticPageType $type, string $view): View { $staticPageModel = StaticPage::getCachedStaticPage($type); $staticPageModel->load(['sections.blocks', 'sections.pictos']); return view($view, [ 'staticPageModel' => $staticPageModel, 'commitmentModels' => $this->getCommitmentModels(), ]); } /** * Display the given commitment page. */ public function getRestpectEarthPage(): View { return $this->renderPage(StaticPageType::respectTheEarth, 'fo.pages.commitments.respect'); } /** * Display the given commitment page. */ public function getLivingToghether(): View { return $this->renderPage(StaticPageType::forLivingTogether, 'fo.pages.commitments.life'); } /** * Display the given commitment brand poultry page. */ public function getBrandPoultry(): View { return $this->renderPage(StaticPageType::poultryBrand, 'fo.pages.commitments.brand'); } /** * Display the given page. */ public function getRaiseSustainably(): View { return $this->renderPage(StaticPageType::raiseSustainably, 'fo.pages.commitments.raise'); } /** * Display the given page. */ public function getFeedProperly(): View { return $this->renderPage(StaticPageType::feedProperly, 'fo.pages.commitments.eat'); } }