move into sonardesk
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user