Refactor to remove slices and environments, replace with instances.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user