Storage::disk(self::DISK)->delete($week->path)); } protected function casts(): array { return ['week_start' => 'date']; } public static function mondayOf(Carbon|string $date): Carbon { return Carbon::parse($date)->startOfWeek(Carbon::MONDAY)->startOfDay(); } /** * @return array */ public function present(): array { $end = $this->week_start->copy()->addDays(4); return [ 'id' => $this->id, 'week_start' => $this->week_start->toDateString(), 'week' => (int) $this->week_start->isoWeek(), 'label' => 'KW '.$this->week_start->isoWeek().' · '.$this->week_start->format('d.m.').' – '.$end->format('d.m.Y'), 'image_url' => route('speiseplan.image', ['week' => $this->id, 'v' => $this->updated_at?->timestamp]), 'width' => $this->width, 'height' => $this->height, ]; } }