File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1313
1414trait BelongsToKnowledgeBase
1515{
16- protected ?string $ knowledgeBaseKeyAttribute = null ;
17-
1816 public static function bootBelongsToKnowledgeBase ()
1917 {
2018 static ::created (queueable (function (Model $ model ) {
@@ -40,6 +38,11 @@ public function knowledgeBasePayload(): array
4038 return [];
4139 }
4240
41+ public function knowledgeBaseKeyAttribute (): ?string
42+ {
43+ return null ;
44+ }
45+
4346 /**
4447 * @return KnowledgeInsertItem[]
4548 */
@@ -62,8 +65,8 @@ public function knowledgeInsertItems(): array
6265 $ chunk ->update (['text ' => $ text ->text ]);
6366 }
6467
65- $ key = $ this ->knowledgeBaseKeyAttribute ? $ this ->{$ this ->knowledgeBaseKeyAttribute } : $ this ->getKey ();
66-
68+ $ key = $ this ->knowledgeBaseKeyAttribute () ? $ this ->{$ this ->knowledgeBaseKeyAttribute () } : $ this ->getKey ();
69+
6770 $ items [] = new KnowledgeInsertItem (
6871 id: $ chunk ->id ,
6972 entity: $ text ->entity ,
You can’t perform that action at this time.
0 commit comments