@php $formKey = isset($recipient) ? (string) $recipient->id : 'new'; $useOldInput = (string) old('recipient_key') === $formKey; $formEvents = $useOldInput ? old('events', []) : ($recipient->events ?? []); $formActive = $useOldInput ? (bool) old('is_active') : ($recipient->is_active ?? true); @endphp
@foreach($categories as $category => $categoryLabel)
{{ $categoryLabel }} @foreach($events as $event => $details) @if($details['category'] === $category) @endif @endforeach
@endforeach