@php $isEdit = isset($gallery) && $gallery->exists && $gallery->id; $formAction = $isEdit ? route('admin.galleries.update', $gallery->id) : route('admin.galleries.store'); $formMethod = $isEdit ? 'PUT' : 'POST'; $formTitle = $isEdit ? 'Edit Gallery Item' : 'Create Gallery Item'; $submitText = $isEdit ? 'Update Gallery Item' : 'Save Gallery Item'; @endphp @if ($errors->any())