45 lines
982 B
PHP
45 lines
982 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
|
|
|
class ServiceSlice extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $guarded = [];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'config' => 'array',
|
|
'credentials' => 'encrypted:array',
|
|
];
|
|
}
|
|
|
|
public function service(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Service::class);
|
|
}
|
|
|
|
public function environment(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Environment::class);
|
|
}
|
|
|
|
public function attachments(): HasMany
|
|
{
|
|
return $this->hasMany(EnvironmentAttachment::class);
|
|
}
|
|
|
|
public function operations(): MorphMany
|
|
{
|
|
return $this->morphMany(Operation::class, 'target');
|
|
}
|
|
}
|