where('star', true)->get(); $slides = Slide::query()->where('status', true)->get(); return view( 'theme::pages.home', compact('content', 'products', 'slides') ); } /** * Display a static page * * @param \Illuminate\Http\Request $request * @param \App\Models\StaticPage $static_page_front * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory * @throws \RuntimeException If the static page type is not handled. */ public function displayStaticPage(Request $request, StaticPage $static_page_front) { $static_page = $static_page_front; switch ($static_page->type) { case StaticPageType::contact(): return app(ContactController::class)->contact($request); case StaticPageType::home(): return $this->callAction('home', [$request]); case StaticPageType::legals(): case StaticPageType::sellconditions(): case StaticPageType::confidentiality(): case StaticPageType::faq(): return view('theme::pages.static-page', compact('static_page')); case StaticPageType::crud(): default: throw new \RuntimeException("Unhandled static page {$static_page->type->label}"); } } /** * Display a crud static page * * @param \App\Models\StaticPage $static_page * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory * @throws \RuntimeException If the static page type is not handled. */ public function displayCrudStaticPage(StaticPage $static_page) { if (!$static_page->type->equals(StaticPageType::crud())) { throw new \RuntimeException("Unhandled static page {$static_page->type->label}"); } return view('theme::pages.static-page', compact('static_page')); } }