feat(阶段三): 添加终端知识库关联功能
- 在 Terminal 模型中添加 knowledgeBases 关联关系 - 在 TerminalResource 表单中添加知识库关联选择器 - 使用 Repeater 组件实现多选和优先级管理 - 支持搜索、拖拽排序、防重复选择 - 自动保存和加载关联数据
This commit is contained in:
@@ -72,7 +72,17 @@ class Terminal extends Model
|
||||
*/
|
||||
public function syncLogs()
|
||||
{
|
||||
return $this->hasMany(TerminalSyncLog::class);
|
||||
return $this->hasMany(TerminalSyncLog::class)->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取终端的最新同步日志
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function latestSyncLog()
|
||||
{
|
||||
return $this->hasOne(TerminalSyncLog::class)->latestOfMany();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user