feat: 创建数据模型
- SystemSetting: 系统设置模型,支持配置管理 - Terminal: 终端模型,支持终端管理 - TerminalKnowledgeBase: 终端知识库关联模型 - TerminalPrompt: 终端提示词模型 - TerminalSyncLog: 终端同步日志模型 - SopTemplate: SOP模板模型 - SopStep: SOP步骤模型 - SopInteractiveTask: SOP交互任务模型 - SopTemplateVersion: SOP模板版本模型 所有模型集成 LogsActivity trait 用于操作日志记录
This commit is contained in:
52
app/Models/TerminalKnowledgeBase.php
Normal file
52
app/Models/TerminalKnowledgeBase.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class TerminalKnowledgeBase extends Model
|
||||
{
|
||||
/**
|
||||
* 可批量赋值的属性
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'terminal_id',
|
||||
'knowledge_base_id',
|
||||
'priority',
|
||||
];
|
||||
|
||||
/**
|
||||
* 属性类型转换
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'priority' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关联的终端
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function terminal(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Terminal::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关联的知识库
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function knowledgeBase(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(KnowledgeBase::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user