coolify/app/Models/Environment.php

37 lines
756 B
PHP
Raw Normal View History

<?php
namespace App\Models;
2023-04-25 14:43:35 +02:00
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
class Environment extends Model
{
2023-04-25 14:43:35 +02:00
protected $fillable = [
'name',
'project_id',
];
protected function name(): Attribute
{
return Attribute::make(
set: fn (string $value) => strtolower($value),
);
}
2023-03-28 15:47:37 +02:00
public function project()
{
return $this->belongsTo(Project::class);
}
public function applications()
{
2023-03-27 18:14:33 +02:00
return $this->hasMany(Application::class);
}
public function databases()
{
2023-03-27 18:14:33 +02:00
return $this->hasMany(Database::class);
}
2023-03-28 08:28:03 +02:00
public function services()
{
return $this->hasMany(Service::class);
}
}