28 خطوط
768 B
PHP
28 خطوط
768 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
|
|
class AutomationRun extends Model
|
|
{
|
|
protected $fillable = ['automation_rule_id', 'subject_type', 'subject_id', 'status', 'attempt', 'event_key', 'input', 'output', 'error', 'started_at', 'completed_at'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['input' => 'array', 'output' => 'array', 'started_at' => 'datetime', 'completed_at' => 'datetime'];
|
|
}
|
|
|
|
public function rule(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AutomationRule::class, 'automation_rule_id');
|
|
}
|
|
|
|
public function subject(): MorphTo
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
}
|