wip: services

This commit is contained in:
Andras Bacsai
2023-09-21 17:48:31 +02:00
parent 301469de6b
commit 6b75ff7de4
29 changed files with 632 additions and 427 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Models;
use App\Enums\ProxyStatus;
use App\Enums\ProxyTypes;
use Illuminate\Database\Eloquent\Builder;
use Spatie\SchemalessAttributes\Casts\SchemalessAttributes;
use Spatie\SchemalessAttributes\SchemalessAttributesTrait;
@@ -77,6 +79,12 @@ class Server extends BaseModel
}
public function proxyType() {
$type = $this->proxy->get('type');
if (is_null($type)) {
$this->proxy->type = ProxyTypes::TRAEFIK_V2->value;
$this->proxy->status = ProxyStatus::EXITED->value;
$this->save();
}
return $this->proxy->get('type');
}
public function scopeWithProxy(): Builder
@@ -107,6 +115,9 @@ class Server extends BaseModel
return $standaloneDocker->applications;
})->flatten();
}
public function services() {
return $this->hasMany(Service::class);
}
public function previews() {
return $this->destinations()->map(function ($standaloneDocker) {