{{-- resources/views/layouts/store.blade.php (refactored to use messages.* keys) --}} @php use Illuminate\Support\Str; // Safe defaults $primary = $s->primary_color ?? '#6c5ce7'; $secondary = $s->secondary_color ?? '#00c2ff'; $title = $s->seo_meta_title ?? ($s->store_name ?? __('messages.Store')); $desc = $s->seo_meta_description ?? ''; // Social links may be array or JSON string — normalize to [{platform,url}] $social = $s->social_links ?? []; if (is_string($social)) { $d = json_decode($social, true); if (json_last_error() === JSON_ERROR_NONE) $social = $d; } if (!is_array($social)) { $social = []; } // assoc → convert {platform:url} to [{platform,url}] $isAssoc = array_keys($social) !== range(0, count($social) - 1); if ($isAssoc) { $social = collect($social)->map(fn($u,$p)=>['platform'=>$p,'url'=>$u])->values()->all(); } // Resolve asset path whether it's absolute or relative $assetPath = function ($p) { if (!$p) return ''; return Str::startsWith($p, ['/','http://','https://']) ? $p : asset($p); }; // Store-account (customer) from 'store' guard $client = Auth::guard('store')->user(); // Account links (safe fallbacks if the named routes don't exist) $accountUrl = url('/online_store/account'); $ordersUrl = url('/online_store/account/orders'); $logoutUrl = url('/online_store/logout'); $loginUrl = url('/online_store/login'); $registerUrl = url('/online_store/register'); // Avatar helpers $displayName = $client ? ($client->username ?: ($client->email ?? __('messages.Account'))) : ''; $initial = $client ? Str::upper(Str::substr($displayName, 0, 1)) : ''; $avatar = $client ? ($client->avatar_path ?? $client->avatar_url ?? null) : null; $avatarSrc = $avatar ? (Str::startsWith($avatar, ['http://','https://','/']) ? $avatar : asset($avatar)) : null; // Local assets (no leading slash to avoid //) $cssBootstrap = asset('store_files/css/bootstrap.min.css'); $cssBootstrapIcons = asset('store_files/css/bootstrap-icons.css'); $jsBootstrap = asset('store_files/js/bootstrap.bundle.min.js'); // RTL detection $rtlLocales = ['ar','he','fa','ur']; @endphp