feat: migrate env variables to polymorphic relationship
fix: proxy status query ui
This commit is contained in:
@@ -695,46 +695,62 @@ class Application extends BaseModel
|
||||
return $this->settings->is_static ? [80] : $this->ports_exposes_array;
|
||||
}
|
||||
|
||||
public function environment_variables(): HasMany
|
||||
public function environment_variables()
|
||||
{
|
||||
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', false)->orderBy('key', 'asc');
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
->where('is_preview', false)
|
||||
->orderBy('key', 'asc');
|
||||
}
|
||||
|
||||
public function runtime_environment_variables(): HasMany
|
||||
public function runtime_environment_variables()
|
||||
{
|
||||
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', false)->where('key', 'not like', 'NIXPACKS_%');
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
->where('is_preview', false)
|
||||
->where('key', 'not like', 'NIXPACKS_%');
|
||||
}
|
||||
|
||||
// Preview Deployments
|
||||
|
||||
public function build_environment_variables(): HasMany
|
||||
public function build_environment_variables()
|
||||
{
|
||||
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', false)->where('is_build_time', true)->where('key', 'not like', 'NIXPACKS_%');
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
->where('is_preview', false)
|
||||
->where('is_build_time', true)
|
||||
->where('key', 'not like', 'NIXPACKS_%');
|
||||
}
|
||||
|
||||
public function nixpacks_environment_variables(): HasMany
|
||||
public function nixpacks_environment_variables()
|
||||
{
|
||||
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', false)->where('key', 'like', 'NIXPACKS_%');
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
->where('is_preview', false)
|
||||
->where('key', 'like', 'NIXPACKS_%');
|
||||
}
|
||||
|
||||
public function environment_variables_preview(): HasMany
|
||||
public function environment_variables_preview()
|
||||
{
|
||||
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', true)->orderBy('key', 'asc');
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
->where('is_preview', true)
|
||||
->orderByRaw("LOWER(key) LIKE LOWER('SERVICE%') DESC, LOWER(key) ASC");
|
||||
}
|
||||
|
||||
public function runtime_environment_variables_preview(): HasMany
|
||||
public function runtime_environment_variables_preview()
|
||||
{
|
||||
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', true)->where('key', 'not like', 'NIXPACKS_%');
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
->where('is_preview', true)
|
||||
->where('key', 'not like', 'NIXPACKS_%');
|
||||
}
|
||||
|
||||
public function build_environment_variables_preview(): HasMany
|
||||
public function build_environment_variables_preview()
|
||||
{
|
||||
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', true)->where('is_build_time', true)->where('key', 'not like', 'NIXPACKS_%');
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
->where('is_preview', true)
|
||||
->where('is_build_time', true)
|
||||
->where('key', 'not like', 'NIXPACKS_%');
|
||||
}
|
||||
|
||||
public function nixpacks_environment_variables_preview(): HasMany
|
||||
public function nixpacks_environment_variables_preview()
|
||||
{
|
||||
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', true)->where('key', 'like', 'NIXPACKS_%');
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
->where('is_preview', true)
|
||||
->where('key', 'like', 'NIXPACKS_%');
|
||||
}
|
||||
|
||||
public function scheduled_tasks(): HasMany
|
||||
|
||||
Reference in New Issue
Block a user