updates
This commit is contained in:
@@ -41,13 +41,6 @@ class Application extends BaseModel
|
||||
'private_key_id'
|
||||
];
|
||||
|
||||
public $casts = [
|
||||
'extra_attributes' => SchemalessAttributes::class,
|
||||
];
|
||||
public function scopeWithExtraAttributes(): Builder
|
||||
{
|
||||
return $this->extra_attributes->modelScope();
|
||||
}
|
||||
public function publishDirectory(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
@@ -130,6 +123,10 @@ class Application extends BaseModel
|
||||
{
|
||||
return $this->belongsTo(Environment::class);
|
||||
}
|
||||
public function previews()
|
||||
{
|
||||
return $this->hasMany(ApplicationPreview::class);
|
||||
}
|
||||
public function settings()
|
||||
{
|
||||
return $this->hasOne(ApplicationSetting::class);
|
||||
@@ -149,9 +146,7 @@ class Application extends BaseModel
|
||||
|
||||
public function deployments()
|
||||
{
|
||||
$asd = ApplicationDeploymentQueue::where('application_id', $this->id)->orderBy('created_at', 'desc')->get();
|
||||
return $asd;
|
||||
// return Activity::where('subject_id', $this->id)->where('properties->type', '=', 'deployment')->orderBy('created_at', 'desc')->get();
|
||||
return ApplicationDeploymentQueue::where('application_id', $this->id)->orderBy('created_at', 'desc')->get();
|
||||
}
|
||||
public function get_deployment(string $deployment_uuid)
|
||||
{
|
||||
|
||||
@@ -10,15 +10,10 @@ class ApplicationDeploymentQueue extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'application_id',
|
||||
'deployment_uuid',
|
||||
'pull_request_id',
|
||||
'force_rebuild',
|
||||
'commit',
|
||||
'status',
|
||||
'extra_attributes',
|
||||
];
|
||||
|
||||
public $casts = [
|
||||
'extra_attributes' => SchemalessAttributes::class,
|
||||
];
|
||||
public function scopeWithExtraAttributes(): Builder
|
||||
{
|
||||
return $this->extra_attributes->modelScope();
|
||||
}
|
||||
}
|
||||
|
||||
22
app/Models/ApplicationPreview.php
Normal file
22
app/Models/ApplicationPreview.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class ApplicationPreview extends BaseModel
|
||||
{
|
||||
protected $fillable = [
|
||||
'uuid',
|
||||
'pull_request_id',
|
||||
'fqdn',
|
||||
'status',
|
||||
'application_id',
|
||||
];
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo(Application::class);
|
||||
}
|
||||
static function findPreviewByApplicationAndPullId(int $application_id, int $pull_request_id)
|
||||
{
|
||||
return self::where('application_id', $application_id)->where('pull_request_id', $pull_request_id)->firstOrFail();
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,11 @@ class Server extends BaseModel
|
||||
'extra_attributes' => SchemalessAttributes::class,
|
||||
];
|
||||
|
||||
public function scopeWithExtraAttributes(): Builder
|
||||
{
|
||||
return $this->extra_attributes->modelScope();
|
||||
}
|
||||
|
||||
public function standaloneDockers()
|
||||
{
|
||||
return $this->hasMany(StandaloneDocker::class);
|
||||
@@ -38,10 +43,7 @@ class Server extends BaseModel
|
||||
return $this->hasMany(SwarmDocker::class);
|
||||
}
|
||||
|
||||
public function scopeWithExtraAttributes(): Builder
|
||||
{
|
||||
return $this->extra_attributes->modelScope();
|
||||
}
|
||||
|
||||
|
||||
public function privateKey()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user