Skip to content

Commit e6947d3

Browse files
committed
fix php 8.4 dynamic relationships
1 parent 8c4068a commit e6947d3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/app/Library/CrudPanel/Traits/Relationships.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,9 @@ private function getOverwrittenNameForBelongsTo($field)
274274
{
275275
$relation = $this->getRelationInstance($field);
276276

277-
if (Str::afterLast($field['name'], '.') === $relation->getRelationName() || Str::endsWith($relation->getRelationName(), '{closure}')) {
277+
if (Str::afterLast($field['name'], '.') === $relation->getRelationName() ||
278+
Str::endsWith($relation->getRelationName(), '{closure}') || // php < 8.3
279+
Str::startsWith($relation->getRelationName(), '{closure:')) { // php 8.4+
278280
return $relation->getForeignKeyName();
279281
}
280282

0 commit comments

Comments
 (0)