'datetime', ]; protected $fillable = [ 'name', 'path', 'week', 'year', 'end_date', 'offset', 'status' ]; public static function getFilenameByPeriod(Carbon $endDate, int $offset) { return sprintf('week_%s_%s.tif', (clone $endDate)->subdays($offset)->week, $endDate->year); } public static function projectMosaicNameFormat(Carbon $endDate, int $offset): string { return sprintf('Week_%s_%s', $endDate->clone()->subDays($offset)->week, $endDate->clone()->subDays($offset)->year ); } public function project() { return $this->belongsTo(Project::class); } public function getStartDateAttribute() { return $this->end_date->subDay($this->offset); } protected static function booted(): void { parent::booted(); static::updated(function (ProjectMosaic $projectMosaic) { event(new ProjectMosaicStatus($projectMosaic)); }); } }