diff --git a/includes/pages/schedule/ImportSchedule.php b/includes/pages/schedule/ImportSchedule.php index d7d59d5f..b6ce626d 100644 --- a/includes/pages/schedule/ImportSchedule.php +++ b/includes/pages/schedule/ImportSchedule.php @@ -91,11 +91,7 @@ class ImportSchedule extends BaseController public function edit(Request $request): Response { $scheduleId = $request->getAttribute('schedule_id'); // optional - $schedule = ScheduleUrl::find($scheduleId); - if ($schedule == null) { - $schedule = new ScheduleUrl(); - } return $this->response->withView( 'admin/schedule/edit.twig', diff --git a/resources/views/admin/schedule/edit.twig b/resources/views/admin/schedule/edit.twig index b7023df9..f30f9a4f 100644 --- a/resources/views/admin/schedule/edit.twig +++ b/resources/views/admin/schedule/edit.twig @@ -64,7 +64,11 @@
{% for id,name in locations %}
- {{ f.checkbox('location_' ~ id, name, {'checked': id in schedule.activeLocations.pluck('id')}) }} + {{ f.checkbox( + 'location_' ~ id, + name, + {'checked': schedule and id in schedule.activeLocations.pluck('id')} + ) }}
{% endfor %}