generated from liutk/owl-admin-base
40 lines
979 B
PHP
40 lines
979 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\CheckStatus;
|
|
use App\Enums\CheckType;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* 审核流水
|
|
*/
|
|
class WorkflowLog extends Model
|
|
{
|
|
protected $fillable = ['batch_id', 'check_type', 'check_value', 'check_name', 'user_id', 'subject_type', 'subject_id', 'subject_data', 'is_enable', 'check_user_id', 'checked_at', 'remarks', 'check_status', 'sort'];
|
|
|
|
protected $casts = [
|
|
'check_type' => CheckType::class,
|
|
'check_status' => CheckStatus::class,
|
|
'is_enable' => 'boolean',
|
|
'subject_data' => 'json',
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(Employee::class, 'user_id');
|
|
}
|
|
|
|
public function checkUser()
|
|
{
|
|
return $this->belongsTo(Employee::class, 'check_user_id');
|
|
}
|
|
|
|
public function subject()
|
|
{
|
|
// 定义反向关联
|
|
// $this->morphMany(WorkflowLog::class, 'subject');
|
|
return $this->morphTo();
|
|
}
|
|
}
|