We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e1cea19 + ee17b69 commit 1e992f9Copy full SHA for 1e992f9
src/Traits/BelongsToKnowledgeBase.php
@@ -13,6 +13,8 @@
13
14
trait BelongsToKnowledgeBase
15
{
16
+ protected string $knowledgeBaseKeyAttribute = null;
17
+
18
public static function bootBelongsToKnowledgeBase()
19
20
static::created(queueable(function (Model $model) {
@@ -60,13 +62,15 @@ public function knowledgeInsertItems(): array
60
62
$chunk->update(['text' => $text->text]);
61
63
}
64
65
+ $key = $this->knowledgeBaseKeyAttribute ? $this->{$this->knowledgeBaseKeyAttribute} : $this->getKey();
66
67
$items[] = new KnowledgeInsertItem(
68
id: $chunk->id,
69
entity: $text->entity,
70
text: $text->text,
71
payload: [
72
...$this->knowledgeBasePayload(),
- 'original_record_id' => $this->getKey(),
73
+ 'original_record_id' => $key,
74
],
75
);
76
0 commit comments