feat: local sections in sub-events can use festival-level time slots
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,22 @@ final class TimeSlotController extends Controller
|
||||
|
||||
$timeSlots = $event->timeSlots()->orderBy('date')->orderBy('start_time')->get();
|
||||
|
||||
if ($event->isSubEvent() && request()->boolean('include_parent') && $event->parent_event_id) {
|
||||
$parentTimeSlots = TimeSlot::where('event_id', $event->parent_event_id)
|
||||
->with('event')
|
||||
->orderBy('date')
|
||||
->orderBy('start_time')
|
||||
->get();
|
||||
|
||||
$timeSlots->load('event');
|
||||
$timeSlots->each(fn (TimeSlot $ts) => $ts->setAttribute('source', 'sub_event'));
|
||||
$parentTimeSlots->each(fn (TimeSlot $ts) => $ts->setAttribute('source', 'festival'));
|
||||
|
||||
$timeSlots = $timeSlots->merge($parentTimeSlots)
|
||||
->sortBy([['date', 'asc'], ['start_time', 'asc']])
|
||||
->values();
|
||||
}
|
||||
|
||||
return TimeSlotResource::collection($timeSlots);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user