From 47a324b8efb99994f7851fb8c83f9b92cc1d28c8 Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Tue, 20 Feb 2024 14:20:39 +0100 Subject: [PATCH] feat: support dynamically resolved relationships --- src/Laravel/EloquentResource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Laravel/EloquentResource.php b/src/Laravel/EloquentResource.php index 0695409..fe515f0 100644 --- a/src/Laravel/EloquentResource.php +++ b/src/Laravel/EloquentResource.php @@ -67,7 +67,7 @@ protected function getRelationshipValue(Model $model, Relationship $field, Conte { $method = $this->method($field); - if (method_exists($model, $method)) { + if ($model->isRelation($method)) { $relation = $model->$method(); // If this is a belongs-to relationship, and we only need to get the ID