lasthourcloud/app/Models/ServiceDatabase.php

30 lines
686 B
PHP
Raw Normal View History

2023-09-20 13:42:41 +00:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
2023-09-22 10:08:51 +00:00
use Symfony\Component\Yaml\Yaml;
2023-09-20 13:42:41 +00:00
class ServiceDatabase extends BaseModel
{
use HasFactory;
protected $guarded = [];
2023-09-22 09:23:49 +00:00
public function type()
{
return 'service';
}
2023-09-22 10:08:51 +00:00
public function documentation()
{
return data_get(Yaml::parse($this->service->docker_compose_raw), "services.{$this->name}.documentation", 'https://coolify.io/docs');
}
public function service()
{
return $this->belongsTo(Service::class);
}
2023-09-22 09:23:49 +00:00
public function persistentStorages()
{
return $this->morphMany(LocalPersistentVolume::class, 'resource');
}
2023-09-20 13:42:41 +00:00
}