feat: preselect prod or first env when selecting a project

feat: quickly switch between environments
This commit is contained in:
Andras Bacsai
2024-06-21 13:54:13 +02:00
parent f607aa1233
commit c5083ea897
5 changed files with 59 additions and 2 deletions

View File

@@ -112,4 +112,14 @@ class Project extends BaseModel
{
return $this->postgresqls()->get()->merge($this->redis()->get())->merge($this->mongodbs()->get())->merge($this->mysqls()->get())->merge($this->mariadbs()->get())->merge($this->keydbs()->get())->merge($this->dragonflies()->get())->merge($this->clickhouses()->get());
}
public function default_environment()
{
$default = $this->environments()->where('name', 'production')->first();
if (! $default) {
$default = $this->environments()->sortBy('created_at')->first();
}
return $default;
}
}