@php $company = auth()->user()->company ?? session('company'); $logoPath = null; if ($company && $company->logo) { $path = $company->logo; // Ensure path starts with companies/logos/ if it's just a filename if (!str_starts_with($path, 'companies/logos/') && !str_contains($path, '/')) { $path = 'companies/logos/' . $path; } if (Storage::disk('public')->exists($path)) { $logoPath = asset('storage/' . $path); } } // Use system logo as fallback if (!$logoPath) { $systemLogo = \App\Models\SystemSetting::get('system_logo'); if ($systemLogo && Storage::disk('public')->exists($systemLogo)) { $logoPath = route('storage', $systemLogo); } } @endphp @if ($logoPath) {{ $company->name ?? 'System Logo' }} @else Logo S @endif