Fix styling

This commit is contained in:
Thijmen
2024-06-10 20:43:34 +00:00
committed by github-actions[bot]
parent 41fb6a1fc9
commit d86274cc37
429 changed files with 5307 additions and 2831 deletions

View File

@@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class ServiceDatabase extends BaseModel
{
use HasFactory, SoftDeletes;
protected $guarded = [];
protected static function booted()
@@ -17,39 +18,48 @@ class ServiceDatabase extends BaseModel
$service->fileStorages()->delete();
});
}
public function restart()
{
$container_id = $this->name . '-' . $this->service->uuid;
$container_id = $this->name.'-'.$this->service->uuid;
remote_process(["docker restart {$container_id}"], $this->service->server);
}
public function isLogDrainEnabled()
{
return data_get($this, 'is_log_drain_enabled', false);
}
public function isStripprefixEnabled()
{
return data_get($this, 'is_stripprefix_enabled', true);
}
public function isGzipEnabled()
{
return data_get($this, 'is_gzip_enabled', true);
}
public function type()
{
return 'service';
}
public function serviceType()
{
return null;
}
public function databaseType()
{
$image = str($this->image)->before(':');
if ($image->value() === 'postgres') {
$image = 'postgresql';
}
return "standalone-$image";
}
public function getServiceDatabaseUrl()
{
$port = $this->public_port;
@@ -57,31 +67,40 @@ class ServiceDatabase extends BaseModel
if ($this->service->server->isLocalhost() || isDev()) {
$realIp = base_ip();
}
return "{$realIp}:{$port}";
}
public function team()
{
return data_get($this, 'environment.project.team');
}
public function workdir() {
return service_configuration_dir() . "/{$this->service->uuid}";
public function workdir()
{
return service_configuration_dir()."/{$this->service->uuid}";
}
public function service()
{
return $this->belongsTo(Service::class);
}
public function persistentStorages()
{
return $this->morphMany(LocalPersistentVolume::class, 'resource');
}
public function fileStorages()
{
return $this->morphMany(LocalFileVolume::class, 'resource');
}
public function getFilesFromServer(bool $isInit = false)
{
getFilesystemVolumesFromServer($this, $isInit);
}
public function scheduledBackups()
{
return $this->morphMany(ScheduledDatabaseBackup::class, 'database');