An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
refactor(global-search, environment): streamline environment retrieval with new query method
Andras Bacsaib803a137f6c4
diff --git a/app/Livewire/GlobalSearch.php b/app/Livewire/GlobalSearch.phpindex f98b8e09a5..87008e45ec 100644--- a/app/Livewire/GlobalSearch.php+++ b/app/Livewire/GlobalSearch.php@@ -543,10 +543,7 @@ class GlobalSearch extends Component});// Get all environments- $environments = Environment::query()- ->whereHas('project', function ($query) {- $query->where('team_id', auth()->user()->currentTeam()->id);- })+ $environments = Environment::ownedByCurrentTeam()->with('project')->withCount(['applications', 'services'])->get()diff --git a/app/Models/Environment.php b/app/Models/Environment.phpindex bfeee01c93..c2ad9d2cb9 100644--- a/app/Models/Environment.php+++ b/app/Models/Environment.php@@ -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 &&