[fix] Mosaic name was not set in db.
This commit is contained in:
parent
ecc1a9a47b
commit
9e5eda0277
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
use App\Jobs\ProjectMosiacGeneratorJob;
|
use App\Jobs\ProjectMosiacGeneratorJob;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
|
use App\Models\ProjectMosaic;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithPagination;
|
use Livewire\WithPagination;
|
||||||
|
|
@ -38,7 +39,7 @@ public function saveMosaic()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$mosaic = $this->project->mosaics()->updateOrCreate([
|
$mosaic = $this->project->mosaics()->updateOrCreate([
|
||||||
'name' => sprintf('', $this->formData['end_date'], $this->formData['offset']),
|
'name' => ProjectMosaic::projectMosaicNameFormat(new Carbon($this->formData['end_date']),(int) $this->formData['offset']),
|
||||||
'offset' => $this->formData['offset'],
|
'offset' => $this->formData['offset'],
|
||||||
'end_date' => $this->formData['end_date'],
|
'end_date' => $this->formData['end_date'],
|
||||||
], [
|
], [
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,11 @@ 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'));
|
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()
|
public function project()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Project::class);
|
return $this->belongsTo(Project::class);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue