Save storage on initial creation

This commit is contained in:
Andras Bacsai 2024-02-14 10:21:53 +01:00
parent 93e4fc2f32
commit 4b08abc144

View File

@ -10,12 +10,19 @@ class LocalFileVolume extends BaseModel
use HasFactory;
protected $guarded = [];
protected static function booted()
{
static::created(function (LocalFileVolume $fileVolume) {
$fileVolume->saveStorageOnServer($fileVolume->service);
});
}
public function service()
{
return $this->morphTo('resource');
}
public function saveStorageOnServer(ServiceApplication|ServiceDatabase $service)
{
ray('saveStorageOnServer');
$workdir = $service->service->workdir();
$server = $service->service->server;
$commands = collect([