move into sonardesk

This commit is contained in:
Mark Gregory
2026-10-12 14:50:13 +01:00
parent 5f0d2ceb72
commit 38b4a7406f
879 changed files with 24021 additions and 1 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace Modules\Workflow\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
final class WorkflowInstance extends Model
{
protected $fillable = ['workflow_definition_id', 'workflow_stage_id', 'subject_type', 'subject_id', 'status', 'started_by', 'assigned_to', 'due_at', 'completed_at'];
protected function casts(): array
{
return ['due_at' => 'datetime', 'completed_at' => 'datetime'];
}
public function definition(): BelongsTo
{
return $this->belongsTo(WorkflowDefinition::class, 'workflow_definition_id');
}
public function stage(): BelongsTo
{
return $this->belongsTo(WorkflowStage::class, 'workflow_stage_id');
}
public function subject(): MorphTo
{
return $this->morphTo();
}
public function history(): HasMany
{
return $this->hasMany(WorkflowHistory::class)->latest();
}
}