@php // several galleries can share a page (one per variant group), so the ids // must stay unique even when the field name repeats $uid = $input_id ?? \Illuminate\Support\Str::slug($name, '-'); $fileId = 'input-multi-' . $uid; $existingId = 'existing-' . $uid; // the file input carries the new uploads, the hidden input the kept paths $fileName = $file_name ?? $name; $existingName = $existing_name ?? $name . '_existing'; @endphp