65 lines
1.5 KiB
PHP
65 lines
1.5 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace plugin\produce\app\model;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class StatusTransition extends BaseModel
|
||
|
|
{
|
||
|
|
protected $table = 'produce_status_transition';
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'id',
|
||
|
|
'step_id',
|
||
|
|
'from_status_id',
|
||
|
|
'to_status_id',
|
||
|
|
'trigger_event',
|
||
|
|
'event_config',
|
||
|
|
'auto_trigger',
|
||
|
|
'priority',
|
||
|
|
'transition_type',
|
||
|
|
'side_effect_type',
|
||
|
|
'side_effect_config',
|
||
|
|
'description',
|
||
|
|
'sort',
|
||
|
|
'status',
|
||
|
|
'created_by',
|
||
|
|
'updated_by',
|
||
|
|
'created_at',
|
||
|
|
'updated_at',
|
||
|
|
'deleted_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'step_id' => 'integer',
|
||
|
|
'from_status_id' => 'integer',
|
||
|
|
'to_status_id' => 'integer',
|
||
|
|
'event_config' => 'array',
|
||
|
|
'auto_trigger' => 'integer',
|
||
|
|
'priority' => 'integer',
|
||
|
|
'side_effect_config' => 'array',
|
||
|
|
'sort' => 'integer',
|
||
|
|
'status' => 'integer',
|
||
|
|
'created_at' => 'integer',
|
||
|
|
'updated_at' => 'integer',
|
||
|
|
'deleted_at' => 'integer',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function step(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(ProcessStep::class, 'step_id', 'id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function fromStatus(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(StepStatus::class, 'from_status_id', 'id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function toStatus(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(StepStatus::class, 'to_status_id', 'id');
|
||
|
|
}
|
||
|
|
}
|