resource; $hasCanEditKey = is_array($res) && array_key_exists('can_edit', $res); return [ 'teacher_name' => $this['teacher_name'] ?? null, 'students' => $this['students'] ?? [], 'teachers' => $this['teachers'] ?? [], 'class_section_id' => $this['class_section_id'] ?? null, 'sunday_dates' => $this['sunday_dates'] ?? [], 'current_sunday' => $this['current_sunday'] ?? null, 'enable_attendance' => $this['enable_attendance'] ?? null, // Do not default missing `can_edit` to false — that disables the whole form while attendance is enabled. 'can_edit' => $hasCanEditKey ? (bool) $this['can_edit'] : ($enable === 1), 'class_id' => $this['class_id'] ?? null, 'no_school_days' => $this['no_school_days'] ?? [], 'today' => $this['today'] ?? null, 'locked_by_student' => $this['locked_by_student'] ?? [], ]; } }