Format: JPG, PNG, GIF, WEBP. Maksimal 2MB. Upload foto baru untuk menggantinya.
@if($user->photo && \Storage::disk('uploads')->exists('profiles/' . $user->photo))
Foto saat ini sudah ada. Upload foto baru untuk menggantinya.
@endif
@error('photo')
{{ $message }}
@enderror
@php
$hasPhoto = false;
$photoUrl = '';
if ($user->photo) {
// Handle jika photo sudah berisi path 'profiles/' atau hanya filename
$photoPath = (strpos($user->photo, 'profiles/') === 0)
? $user->photo
: 'profiles/' . $user->photo;
// Cek apakah file exists
if (\Storage::disk('uploads')->exists($photoPath)) {
$hasPhoto = true;
// Untuk URL, gunakan path yang benar
$photoFileName = (strpos($user->photo, 'profiles/') === 0)
? $user->photo
: 'profiles/' . $user->photo;
$photoUrl = asset('uploads/' . $photoFileName);
}
}
@endphp