2023-03-27 08:44:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
class Project extends BaseModel
|
|
|
|
{
|
2023-03-30 09:09:39 +00:00
|
|
|
protected static function booted()
|
|
|
|
{
|
|
|
|
static::created(function ($project) {
|
|
|
|
ProjectSetting::create([
|
|
|
|
'project_id' => $project->id,
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
}
|
2023-03-27 08:44:31 +00:00
|
|
|
public function environments() {
|
|
|
|
return $this->hasMany(Environment::class);
|
|
|
|
}
|
|
|
|
public function settings() {
|
|
|
|
return $this->hasOne(ProjectSetting::class);
|
|
|
|
}
|
2023-03-30 17:50:27 +00:00
|
|
|
public function applications() {
|
|
|
|
return $this->hasManyThrough(Application::class, Environment::class);
|
|
|
|
}
|
2023-03-27 08:44:31 +00:00
|
|
|
}
|