style updates
This commit is contained in:
@@ -1,12 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Automation\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
final class Automation extends Model
|
||||
{
|
||||
protected $fillable=['name','description','trigger_type','trigger_config','status','stop_on_failure','run_count','last_ran_at','next_run_at','created_by'];
|
||||
protected $casts=['trigger_config'=>'array','stop_on_failure'=>'boolean','last_ran_at'=>'datetime','next_run_at'=>'datetime'];
|
||||
public function steps(): HasMany { return $this->hasMany(AutomationStep::class)->orderBy('position'); }
|
||||
public function runs(): HasMany { return $this->hasMany(AutomationRun::class); }
|
||||
public function isActive(): bool { return $this->status === 'active'; }
|
||||
protected $fillable = ['name', 'description', 'trigger_type', 'trigger_config', 'status', 'stop_on_failure', 'run_count', 'last_ran_at', 'next_run_at', 'created_by'];
|
||||
|
||||
protected $casts = ['trigger_config' => 'array', 'stop_on_failure' => 'boolean', 'last_ran_at' => 'datetime', 'next_run_at' => 'datetime'];
|
||||
|
||||
public function steps(): HasMany
|
||||
{
|
||||
return $this->hasMany(AutomationStep::class)->orderBy('position');
|
||||
}
|
||||
|
||||
public function runs(): HasMany
|
||||
{
|
||||
return $this->hasMany(AutomationRun::class);
|
||||
}
|
||||
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->status === 'active';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Automation\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
final class AutomationRun extends Model
|
||||
{
|
||||
protected $fillable=['automation_id','execution_id','trigger_type','payload','status','current_step','error','started_at','finished_at'];
|
||||
protected $casts=['payload'=>'array','started_at'=>'datetime','finished_at'=>'datetime'];
|
||||
public function automation(): BelongsTo { return $this->belongsTo(Automation::class); }
|
||||
public function logs(): HasMany { return $this->hasMany(AutomationRunLog::class); }
|
||||
protected $fillable = ['automation_id', 'execution_id', 'trigger_type', 'payload', 'status', 'current_step', 'error', 'started_at', 'finished_at'];
|
||||
|
||||
protected $casts = ['payload' => 'array', 'started_at' => 'datetime', 'finished_at' => 'datetime'];
|
||||
|
||||
public function automation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Automation::class);
|
||||
}
|
||||
|
||||
public function logs(): HasMany
|
||||
{
|
||||
return $this->hasMany(AutomationRunLog::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Automation\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
final class AutomationRunLog extends Model
|
||||
{
|
||||
public $timestamps=false;
|
||||
protected $fillable=['automation_run_id','automation_step_id','level','message','context','created_at'];
|
||||
protected $casts=['context'=>'array','created_at'=>'datetime'];
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['automation_run_id', 'automation_step_id', 'level', 'message', 'context', 'created_at'];
|
||||
|
||||
protected $casts = ['context' => 'array', 'created_at' => 'datetime'];
|
||||
}
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Automation\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
final class AutomationStep extends Model
|
||||
{
|
||||
protected $fillable=['automation_id','position','action_type','name','configuration','is_enabled'];
|
||||
protected $casts=['configuration'=>'array','is_enabled'=>'boolean'];
|
||||
public function automation(): BelongsTo { return $this->belongsTo(Automation::class); }
|
||||
protected $fillable = ['automation_id', 'position', 'action_type', 'name', 'configuration', 'is_enabled'];
|
||||
|
||||
protected $casts = ['configuration' => 'array', 'is_enabled' => 'boolean'];
|
||||
|
||||
public function automation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Automation::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user