Skip to content

Commit 04bba38

Browse files
authored
Add macro check when populate relations
1 parent cf2dbf7 commit 04bba38

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/Populator.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,7 @@ protected function fillRelations(Model $model, array $data): void
126126

127127
$relation = Str::camel($relation);
128128

129-
if (method_exists($model, $relation) && call_user_func([$model, $relation]) instanceof Relation) {
130-
131-
// if (is_string($relationData) || is_bool($relationData)) {
132-
// dump(get_class($model));
133-
// dump($relation);
134-
// dump($relationData);
135-
// dd();
136-
// }
129+
if ((method_exists($model, $relation) || $model::hasMacro($relation)) && $model->$relation() instanceof Relation) {
137130

138131
$this->populateRelation($model, $relation, $relationData);
139132
}

0 commit comments

Comments
 (0)