Implement Keystone environment deployments
This commit is contained in:
56
app/Models/Environment.php
Normal file
56
app/Models/Environment.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\SchedulerMode;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
|
||||
class Environment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'scheduler_enabled' => 'boolean',
|
||||
'scheduler_mode' => SchedulerMode::class,
|
||||
'build_config' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
public function application(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Application::class);
|
||||
}
|
||||
|
||||
public function services(): HasMany
|
||||
{
|
||||
return $this->hasMany(Service::class);
|
||||
}
|
||||
|
||||
public function attachments(): HasMany
|
||||
{
|
||||
return $this->hasMany(EnvironmentAttachment::class);
|
||||
}
|
||||
|
||||
public function variables(): HasMany
|
||||
{
|
||||
return $this->hasMany(EnvironmentVariable::class);
|
||||
}
|
||||
|
||||
public function buildArtifacts(): HasMany
|
||||
{
|
||||
return $this->hasMany(BuildArtifact::class);
|
||||
}
|
||||
|
||||
public function operations(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Operation::class, 'target');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user