wip: services
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user