From a03884d2feaa40739e19e739c87fa0f35adb5336 Mon Sep 17 00:00:00 2001 From: Sander Muller Date: Wed, 4 Sep 2024 16:44:52 +0200 Subject: [PATCH] Handle end return type without docblock --- src/Relations/BelongsToThrough.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Relations/BelongsToThrough.php b/src/Relations/BelongsToThrough.php index 924e870..09c0b41 100644 --- a/src/Relations/BelongsToThrough.php +++ b/src/Relations/BelongsToThrough.php @@ -335,9 +335,12 @@ public function getThroughParents() */ public function getFirstForeignKeyName() { - /** @var \Illuminate\Database\Eloquent\Model $firstThroughParent */ $firstThroughParent = end($this->throughParents); + if ($firstThroughParent === false) { + $firstThroughParent = $this->parent; + } + return $this->prefix . $this->getForeignKeyName($firstThroughParent); } @@ -348,9 +351,12 @@ public function getFirstForeignKeyName() */ public function getQualifiedFirstLocalKeyName() { - /** @var \Illuminate\Database\Eloquent\Model $lastThroughParent */ $lastThroughParent = end($this->throughParents); + if ($lastThroughParent === false) { + $lastThroughParent = $this->parent; + } + return $lastThroughParent->qualifyColumn($this->getLocalKeyName($lastThroughParent)); }