|
|
@@ -130,28 +130,4 @@ class PreQuestionCandidate extends Model
|
|
|
|
|
|
return \Str::limit($this->stem, 100);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 重写getKey方法,确保返回字符串类型
|
|
|
- * 解决Filament表格渲染时的TypeError问题
|
|
|
- */
|
|
|
- public function getKey(): int|string
|
|
|
- {
|
|
|
- $key = parent::getKey();
|
|
|
-
|
|
|
- // 如果键值为null,返回一个默认值(基于时间戳和随机数)
|
|
|
- if ($key === null) {
|
|
|
- return 'temp_' . time() . '_' . mt_rand(1000, 9999);
|
|
|
- }
|
|
|
-
|
|
|
- return $key;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 重写getKeyName方法,返回主键名称
|
|
|
- */
|
|
|
- public function getKeyName(): string
|
|
|
- {
|
|
|
- return 'id';
|
|
|
- }
|
|
|
}
|