feat: resources api endpoint

This commit is contained in:
Andras Bacsai
2024-03-07 11:35:00 +01:00
parent 5e2afd4b4d
commit c7693d0ec3
3 changed files with 39 additions and 5 deletions

View File

@@ -27,7 +27,8 @@ class Project extends BaseModel
$project->settings()->delete();
});
}
public function environment_variables() {
public function environment_variables()
{
return $this->hasMany(SharedEnvironmentVariable::class);
}
public function environments()
@@ -74,7 +75,8 @@ class Project extends BaseModel
{
return $this->hasManyThrough(StandaloneMariadb::class, Environment::class);
}
public function resource_count() {
public function resource_count()
{
return $this->applications()->count() + $this->postgresqls()->count() + $this->redis()->count() + $this->mongodbs()->count() + $this->mysqls()->count() + $this->mariadbs()->count();
}
}