Refactor to remove slices and environments, replace with instances.

This commit is contained in:
2025-09-15 12:19:13 +01:00
parent a91780d1d5
commit 65d3142d03
24 changed files with 454 additions and 290 deletions

View File

@@ -44,6 +44,16 @@ class Server extends Model
return $this->hasMany(Service::class);
}
public function instances(): HasMany
{
return $this->hasMany(Instance::class);
}
public function applications(): HasManyThrough
{
return $this->hasManyThrough(Application::class, Instance::class);
}
public function firewallRules(): HasMany
{
return $this->hasMany(FirewallRule::class);
@@ -64,14 +74,14 @@ class Server extends Model
)->where('target_type', (new Service)->getMorphClass());
}
public function environmentDeployments(): HasManyThrough
public function applicationDeployments(): HasManyThrough
{
return $this->hasManyThrough(
Deployment::class,
Environment::class,
Application::class,
'server_id',
'target_id',
)->where('target_type', (new Environment)->getMorphClass());
)->where('target_type', (new Application)->getMorphClass());
}
public function sshClient(string $user = 'root'): Ssh