@php /* |-------------------------------------------------------------------------- | Storefront Bootstrap |-------------------------------------------------------------------------- | | এই Blade file শুধু initial storefront shell render করবে। | React load হওয়ার আগেই: | | - Hero/LCP image preload | - Company title/favicon | - Marketing integrations | - React bootstrap data | | প্রস্তুত করা হবে। | */ $storefrontHeroImage = null; $storefrontCompanyName = 'NebuloidBD'; $storefrontFavicon = null; /* |-------------------------------------------------------------------------- | Helper: Resolve Public Media URL |-------------------------------------------------------------------------- */ $resolvePublicMediaUrl = static function ( mixed $value ): ?string { if ( $value === null || $value === '' ) { return null; } $value = trim( (string) $value ); if ($value === '') { return null; } /* |-------------------------------------------------------------------------- | Full HTTP / HTTPS URL |-------------------------------------------------------------------------- */ if ( str_starts_with( $value, 'http://' ) || str_starts_with( $value, 'https://' ) ) { return $value; } /* |-------------------------------------------------------------------------- | Protocol-relative URL |-------------------------------------------------------------------------- | | Example: | //cdn.example.com/image.webp | */ if ( str_starts_with( $value, '//' ) ) { return request()->isSecure() ? 'https:' . $value : 'http:' . $value; } /* |-------------------------------------------------------------------------- | Remove accidental leading slash |-------------------------------------------------------------------------- */ $value = ltrim( $value, '/' ); /* |-------------------------------------------------------------------------- | Common Storage Formats |-------------------------------------------------------------------------- | | DB: | storage/banners/a.webp | | DB: | banners/a.webp | */ if ( str_starts_with( $value, 'storage/' ) ) { return asset( $value ); } /* |-------------------------------------------------------------------------- | Public paths |-------------------------------------------------------------------------- */ return asset( $value ); }; /* |-------------------------------------------------------------------------- | Hero Image / LCP Bootstrap |-------------------------------------------------------------------------- */ try { if ( class_exists( \App\Models\Banner::class ) ) { /* * শুধু image reference cache করছি। * পুরো Eloquent model cache করার প্রয়োজন নেই। */ $rawHeroImage = cache()->remember( 'storefront:lcp-banner:v3', now()->addMinutes(5), function () { $banner = \App\Models\Banner::query() ->where( 'status', true ) ->orderBy('id') ->first(); if (! $banner) { return null; } /* * আপনার Banner model-এর বিভিন্ন naming * support করার জন্য fallback রাখা হয়েছে। */ return $banner->image_url ?? $banner->desktop_image_url ?? $banner->image ?? $banner->desktop_image ?? null; } ); $storefrontHeroImage = $resolvePublicMediaUrl( $rawHeroImage ); } } catch (\Throwable $exception) { /* * Banner table/model কোনো কারণে unavailable হলেও * storefront 500 error দেবে না। */ $storefrontHeroImage = null; report( $exception ); } /* |-------------------------------------------------------------------------- | Company Settings |-------------------------------------------------------------------------- */ try { if ( class_exists( \App\Models\CompanySetting::class ) ) { $companyBootstrap = cache()->remember( 'storefront:company-bootstrap:v2', now()->addMinutes(10), function () { $company = \App\Models\CompanySetting::query() ->orderBy('id') ->first(); if (! $company) { return null; } return [ 'name' => $company->name, 'favicon' => $company->favicon, ]; } ); if ( is_array( $companyBootstrap ) ) { $companyName = trim( (string) ( $companyBootstrap['name'] ?? '' ) ); if ( $companyName !== '' ) { $storefrontCompanyName = $companyName; } $storefrontFavicon = $resolvePublicMediaUrl( $companyBootstrap['favicon'] ?? null ); } } } catch (\Throwable $exception) { report( $exception ); } @endphp
{{-- ================================================================ Character Encoding ================================================================ --}} {{-- ================================================================ Responsive Viewport ================================================================ --}} {{-- ================================================================ CSRF ================================================================ --}} {{-- ================================================================ Browser / Mobile Hints ================================================================ --}} {{-- ================================================================ Default Title ================================================================ --}}