- SystemSetting: 系统设置模型,支持配置管理 - Terminal: 终端模型,支持终端管理 - TerminalKnowledgeBase: 终端知识库关联模型 - TerminalPrompt: 终端提示词模型 - TerminalSyncLog: 终端同步日志模型 - SopTemplate: SOP模板模型 - SopStep: SOP步骤模型 - SopInteractiveTask: SOP交互任务模型 - SopTemplateVersion: SOP模板版本模型 所有模型集成 LogsActivity trait 用于操作日志记录
63 lines
1.2 KiB
PHP
63 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class SopTemplateVersion extends Model
|
|
{
|
|
/**
|
|
* 表示模型是否应该被打上时间戳
|
|
* 注意: 只有created_at字段,没有updated_at
|
|
*
|
|
* @var bool
|
|
*/
|
|
public $timestamps = false;
|
|
|
|
/**
|
|
* 可批量赋值的属性
|
|
*
|
|
* @var array<string>
|
|
*/
|
|
protected $fillable = [
|
|
'sop_template_id',
|
|
'version',
|
|
'change_log',
|
|
'content_snapshot',
|
|
'created_by',
|
|
];
|
|
|
|
/**
|
|
* 属性类型转换
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'content_snapshot' => 'array',
|
|
'created_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 获取版本所属的模板
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function template()
|
|
{
|
|
return $this->belongsTo(SopTemplate::class, 'sop_template_id');
|
|
}
|
|
|
|
/**
|
|
* 获取版本的创建者
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
}
|