session(), $store); } /** * Every store page gets the same basics: the design, the fonts, the product list and the cart. * * @param array $view Which page to show. */ private function renderStorefront(Request $request, Storefront $storefront, array $view): Response { $store = $storefront->store; return Inertia::render('stores/preview', [ 'storeName' => $store->name, 'language' => $store->language->value, 'plan' => $storefront->plan, 'fonts' => PlanSchema::FONTS, // Links inside the store are built on top of this address. It is empty for a live store. 'baseUrl' => $storefront->baseUrl, 'preview' => $storefront->preview, 'view' => $view, 'products' => $store->products() ->active() ->with('images') ->latest('id') ->limit(60) ->get() ->map(fn (Product $product) => $product->toStorefront()), 'cart' => $this->cart($request, $store)->toStorefront(), 'shop' => [ // Digits only, such as 60123456789, or null when the merchant has not set one. 'whatsapp' => $store->whatsapp_number, // In ringgit, or null when shipping is never free. 'free_shipping_over' => $store->free_shipping_over !== null ? $store->free_shipping_over / 100 : null, ], ]); } }