'datetime', ]; protected $fillable = [ 'name', 'path', 'week', 'year', 'end_date', 'offset', 'status' ]; public static function getFilenameByPeriod(Carbon $endDate,int $offset) { return sprintf('period_%s_%s.tif',(clone $endDate)->subdays($offset)->format('Y-m-d'),$endDate->format('Y-m-d')); } public static function projectMosaicNameFormat(Carbon $endDate,int $offset):string { return 'Period '.$endDate->copy()->subDays($offset)->toDateString().' - '.$endDate->toDateString(); } 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)); }); } }