2023-03-27 12:31:42 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
class StandaloneDocker extends BaseModel
|
|
|
|
{
|
2023-08-11 14:13:53 +00:00
|
|
|
protected $guarded = [];
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-03-27 12:31:42 +00:00
|
|
|
public function applications()
|
|
|
|
{
|
|
|
|
return $this->morphMany(Application::class, 'destination');
|
|
|
|
}
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-08-07 16:46:40 +00:00
|
|
|
public function postgresqls()
|
2023-05-16 09:02:51 +00:00
|
|
|
{
|
2023-08-07 20:14:21 +00:00
|
|
|
return $this->morphMany(StandalonePostgresql::class, 'destination');
|
2023-05-16 09:02:51 +00:00
|
|
|
}
|
2023-10-19 11:32:03 +00:00
|
|
|
|
2023-10-12 15:18:33 +00:00
|
|
|
public function redis()
|
|
|
|
{
|
|
|
|
return $this->morphMany(StandaloneRedis::class, 'destination');
|
|
|
|
}
|
2023-10-19 11:32:03 +00:00
|
|
|
public function mongodbs()
|
|
|
|
{
|
|
|
|
return $this->morphMany(StandaloneMongodb::class, 'destination');
|
|
|
|
}
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-03-28 13:47:37 +00:00
|
|
|
public function server()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Server::class);
|
|
|
|
}
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-09-21 15:48:31 +00:00
|
|
|
public function services()
|
2023-09-20 13:42:41 +00:00
|
|
|
{
|
2023-09-21 15:48:31 +00:00
|
|
|
return $this->morphMany(Service::class, 'destination');
|
2023-09-20 13:42:41 +00:00
|
|
|
}
|
|
|
|
|
2023-05-16 09:02:51 +00:00
|
|
|
public function attachedTo()
|
|
|
|
{
|
2023-09-08 14:19:45 +00:00
|
|
|
return $this->applications?->count() > 0 || $this->databases?->count() > 0;
|
2023-05-16 09:02:51 +00:00
|
|
|
}
|
2023-08-07 20:14:21 +00:00
|
|
|
}
|