diff --git a/src/Illuminate/Database/Eloquent/PendingHasThroughRelationship.php b/src/Illuminate/Database/Eloquent/PendingHasThroughRelationship.php index 4b6aad6cd16e..f42fdbbf2333 100644 --- a/src/Illuminate/Database/Eloquent/PendingHasThroughRelationship.php +++ b/src/Illuminate/Database/Eloquent/PendingHasThroughRelationship.php @@ -4,7 +4,6 @@ use BadMethodCallException; use Illuminate\Database\Eloquent\Relations\HasMany; -use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\MorphOneOrMany; use Illuminate\Support\Str; @@ -66,7 +65,7 @@ public function has($callback) $distantRelation = $callback($this->localRelationship->getRelated()); if ($distantRelation instanceof HasMany) { - $returnedRelation = $this->rootModel->hasManyThrough( + $returnedRelation = $this->rootModel->hasManyThrough( $distantRelation->getRelated()::class, $this->localRelationship->getRelated()::class, $this->localRelationship->getForeignKeyName(), diff --git a/tests/Integration/Database/EloquentThroughTest.php b/tests/Integration/Database/EloquentThroughTest.php index 338dca202d55..25f860cb71b0 100644 --- a/tests/Integration/Database/EloquentThroughTest.php +++ b/tests/Integration/Database/EloquentThroughTest.php @@ -31,7 +31,6 @@ protected function afterRefreshingDatabase() $table->unsignedInteger('comment_id'); }); - $post = tap(new Post(['public' => true]))->save(); $comment = tap((new Comment)->commentable()->associate($post))->save(); (new Like())->comment()->associate($comment)->save();