From ef019c5e6443e83a77fe3260e246acd8fbe3b946 Mon Sep 17 00:00:00 2001 From: Choraimy Kroonstuiver Date: Wed, 30 Jan 2019 10:23:09 +0100 Subject: [PATCH 1/2] Fixed relation never finding anything when parent is soft deleted --- src/Relations/BelongsToThrough.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Relations/BelongsToThrough.php b/src/Relations/BelongsToThrough.php index 6846ffc..c0bbfdc 100644 --- a/src/Relations/BelongsToThrough.php +++ b/src/Relations/BelongsToThrough.php @@ -133,6 +133,10 @@ public function getQuery() protected function setSoftDeletes() { foreach ($this->models as $model) { + if ($model === $this->parent) { + continue; + } + if ($this->hasSoftDeletes($model)) { $this->getQuery()->whereNull($model->getQualifiedDeletedAtColumn()); } From ec71c2bef128d38d38f7a5d1d1e2979e66357255 Mon Sep 17 00:00:00 2001 From: Rahul Kadyan Date: Wed, 30 Jan 2019 19:15:47 +0530 Subject: [PATCH 2/2] chore: Trigger build --- src/Relations/BelongsToThrough.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Relations/BelongsToThrough.php b/src/Relations/BelongsToThrough.php index c0bbfdc..c508b86 100644 --- a/src/Relations/BelongsToThrough.php +++ b/src/Relations/BelongsToThrough.php @@ -136,7 +136,6 @@ protected function setSoftDeletes() if ($model === $this->parent) { continue; } - if ($this->hasSoftDeletes($model)) { $this->getQuery()->whereNull($model->getQualifiedDeletedAtColumn()); }