renderStorefront($request, $this->ownedStore($request, $slug), [ 'type' => 'page', 'pageId' => PlanSchema::HOME_PAGE, ]); } /** * Any other page of the plan, such as "about". Its id is its address. */ public function page(Request $request, string $slug, string $pageId): Response|RedirectResponse { $store = $this->ownedStore($request, $slug); if ($pageId === PlanSchema::HOME_PAGE) { return to_route('stores.preview', $store->slug); } abort_unless(in_array($pageId, array_column($store->plan['pages'] ?? [], 'id'), true), 404); return $this->renderStorefront($request, $store, ['type' => 'page', 'pageId' => $pageId]); } /** * The shop page: every product shoppers may see. */ public function shop(Request $request, string $slug): Response { return $this->renderStorefront($request, $this->ownedStore($request, $slug), ['type' => 'shop']); } /** * One product's own page. */ public function product(Request $request, string $slug, string $productSlug): Response { $store = $this->ownedStore($request, $slug); $product = $store->products()->active()->with('images')->where('slug', $productSlug)->firstOrFail(); return $this->renderStorefront($request, $store, ['type' => 'product', 'product' => $product->toStorefront()]); } }