Skip to content

Commit c65346f

Browse files
author
Pantea Marius-ciclistu
committed
Override getKey on base Model for \Illuminate\Database\Eloquent\Collection::getDictionary - avoid infinite loop
1 parent cd51fd2 commit c65346f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Models/BaseModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function getIndexRequiredOnFilteringAttribute(): array
115115
public function getPrimaryKeyIdentifierAttribute(): mixed
116116
{
117117
return $this->getKeyName() !== '' ?
118-
$this->getKey() :
118+
$this->getAttributeValue($this->getKeyName()) :
119119
\implode($this::COMPOSITE_PK_SEPARATOR, \array_map(
120120
fn(mixed $value): mixed => (\is_array($value) ? \last($value) : $value),
121121
$this->getPrimaryKeyFilter()

0 commit comments

Comments
 (0)