@php
// Determine the correct profile image path with better error handling
$defaultImagePath = asset('assets/images/profilefoto/default-profile.png');
$profileImagePath = $defaultImagePath;
if ($user->profile && $user->profile->foto) {
$photoPath = public_path('assets/images/profilefoto/' . $user->profile->foto);
if (file_exists($photoPath)) {
$profileImagePath = asset('assets/images/profilefoto/' . $user->profile->foto);
}
}
@endphp
@if($user->profile && $user->profile->foto && file_exists(public_path('assets/images/profilefoto/' . $user->profile->foto)))
@endif