73 lines
1.7 KiB
PHP
73 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace plugin\produce\app\model;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class TransitionLog extends BaseModel
|
|
{
|
|
const UPDATED_AT = null;
|
|
|
|
protected $table = 'produce_transition_log';
|
|
|
|
protected $appends = ['created_date', 'created_name'];
|
|
|
|
protected $fillable = [
|
|
'id',
|
|
'work_order_id',
|
|
'work_order_no',
|
|
'step_id',
|
|
'transition_id',
|
|
'from_status_id',
|
|
'to_status_id',
|
|
'trigger_event',
|
|
'trigger_data',
|
|
'trigger_user',
|
|
'trigger_ip',
|
|
'is_auto',
|
|
'is_success',
|
|
'error_message',
|
|
'duration',
|
|
'remark',
|
|
'created_by',
|
|
'created_at',
|
|
'deleted_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'work_order_id' => 'integer',
|
|
'step_id' => 'integer',
|
|
'transition_id' => 'integer',
|
|
'from_status_id' => 'integer',
|
|
'to_status_id' => 'integer',
|
|
'trigger_data' => 'array',
|
|
'is_auto' => 'integer',
|
|
'is_success' => 'integer',
|
|
'duration' => 'integer',
|
|
'created_at' => 'integer',
|
|
'deleted_at' => 'integer',
|
|
];
|
|
|
|
public function step(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ProcessStep::class, 'step_id', 'id');
|
|
}
|
|
|
|
public function transition(): BelongsTo
|
|
{
|
|
return $this->belongsTo(StatusTransition::class, 'transition_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');
|
|
}
|
|
}
|