From f267d7cb9b159805d3e6ca805210d85f40c27209 Mon Sep 17 00:00:00 2001 From: Sagar Naliyapara Date: Tue, 21 Sep 2021 19:11:09 +0530 Subject: [PATCH] ofMany to decide relationship name when it is null (#38889) --- .../Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php b/src/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php index 71fa6bde3178..6ea802bace1b 100644 --- a/src/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php +++ b/src/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php @@ -137,7 +137,7 @@ public function latestOfMany($column = 'id', $relation = null) { return $this->ofMany(collect(Arr::wrap($column))->mapWithKeys(function ($column) { return [$column => 'MAX']; - })->all(), 'MAX', $relation ?: $this->guessRelationship()); + })->all(), 'MAX', $relation); } /** @@ -152,7 +152,7 @@ public function oldestOfMany($column = 'id', $relation = null) { return $this->ofMany(collect(Arr::wrap($column))->mapWithKeys(function ($column) { return [$column => 'MIN']; - })->all(), 'MIN', $relation ?: $this->guessRelationship()); + })->all(), 'MIN', $relation); } /**