mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-18 05:20:43 +00:00
refactor(global-search, environment): streamline environment retrieval with new query method
- Replaced the inline query for fetching environments in GlobalSearch with a new static method `ownedByCurrentTeam` in the Environment model, enhancing code readability and maintainability. - This change simplifies the logic for retrieving environments associated with the current team, promoting better organization of query logic within the model.
This commit is contained in:
@@ -35,6 +35,11 @@ class Environment extends BaseModel
|
||||
});
|
||||
}
|
||||
|
||||
public static function ownedByCurrentTeam()
|
||||
{
|
||||
return Environment::whereRelation('project.team', 'id', currentTeam()->id)->orderBy('name');
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->applications()->count() == 0 &&
|
||||
|
||||
Reference in New Issue
Block a user