*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'user_id' => $this->user_id, 'doctor' => $this->relationLoaded('doctor') && $this->doctor ? $this->doctor->only(['id', 'fullname']) : null, 'day_of_week' => $this->day_of_week, 'day_index' => $this->day_of_week ? ShiftDayEnum::from($this->day_of_week)->carbonDay() : null, 'date' => $this->date ? verta($this->date)->format('%Y/%m/%d') : null, 'date_raw' => $this->date?->format('Y-m-d'), 'start_time' => substr($this->start_time, 0, 5), 'end_time' => substr($this->end_time, 0, 5), 'is_active' => $this->is_active, 'created_at' => verta($this->created_at)->format('%Y/%m/%d - H:i'), ]; } }