@php
$gallery = is_string($user->photo_gallery) ? json_decode($user->photo_gallery, true) : $user->photo_gallery;
@endphp
@if($gallery && count($gallery) > 0)
@foreach($gallery as $img)
@php
$raw = is_array($img) && isset($img['filename']) ? $img['filename'] : (is_string($img) ? $img : null);
$filename = $raw ? basename($raw) : null;
$storageKey = $filename ? ('gallery/' . $filename) : null;
$imageUrl = ($storageKey && \Illuminate\Support\Facades\Storage::disk('public')->exists($storageKey))
? \Illuminate\Support\Facades\Storage::disk('public')->url($storageKey)
: asset('images/default-placeholder.png');
@endphp
@if($filename)
@endif
@endforeach
@else
لا توجد صور في المعرض.
@endif