Files
fdesk/app/common/model/ApprovalRecords.php
T

79 lines
1.5 KiB
PHP
Raw Normal View History

2025-09-09 17:30:39 +08:00
<?php
2025-09-18 06:46:15 +00:00
namespace app\common\model;
2025-09-09 17:30:39 +08:00
use app\common\model\User;
use support\Model;
class ApprovalRecords extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'approval_records';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
2025-09-18 06:46:15 +00:00
// protected $dateFormat = 'U';
2025-09-09 17:30:39 +08:00
/**
* 允许自动填充模型字段
*/
2025-09-18 06:46:15 +00:00
// protected $fillable = ['id', 'instance_id', 'approver_id', 'step_index', 'action', 'comment', 'approved_at', 'created_at', 'updated_at'];
2025-09-09 17:30:39 +08:00
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
protected $fillable = [
'instance_id',
'approver_id',
'step_index',
'action',
'status',
'comment',
'approved_at',
2025-09-24 11:18:59 +08:00
'round'
2025-09-09 17:30:39 +08:00
];
protected $casts = [
'approved_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
2025-09-18 06:46:15 +00:00
public function instance()
2025-09-09 17:30:39 +08:00
{
2025-09-18 06:46:15 +00:00
return $this->belongsTo(ApprovalInstances::class, 'instance_id', 'id');
2025-09-09 17:30:39 +08:00
}
2025-09-18 06:46:15 +00:00
2025-09-09 17:30:39 +08:00
public function approver()
{
2025-09-18 06:46:15 +00:00
return $this->belongsTo(User::class, 'approver_id', 'id');
2025-09-09 17:30:39 +08:00
}
}