47 lines
1.0 KiB
PHP
47 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Drivers\Driver;
|
|
use App\Enums\ServiceCategory;
|
|
use App\Enums\ServiceStatus;
|
|
use App\Enums\ServiceType;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
|
|
|
class Service extends Model
|
|
{
|
|
protected $guarded = [];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'status' => ServiceStatus::class,
|
|
'category' => ServiceCategory::class,
|
|
'type' => ServiceType::class,
|
|
];
|
|
}
|
|
|
|
public function server(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Server::class);
|
|
}
|
|
|
|
public function slices(): HasMany
|
|
{
|
|
return $this->hasMany(Slice::class);
|
|
}
|
|
|
|
public function deployments(): MorphMany
|
|
{
|
|
return $this->morphMany(Deployment::class, 'deployable');
|
|
}
|
|
|
|
public function driver()//: Driver
|
|
{
|
|
// @todo. This is the class that controls the service
|
|
}
|
|
}
|