diff --git a/src/Model/Join.php b/src/Model/Join.php index 9c1ce50635..916f30c29f 100644 --- a/src/Model/Join.php +++ b/src/Model/Join.php @@ -155,18 +155,12 @@ protected function createFakeForeignModel(): Model public function getForeignModel(): Model { - if (is_string($this->foreign_table)) { - // TODO this should be removed in the future - if (!isset($this->getOwner()->with[$this->foreign_table])) { - return $this->createFakeForeignModel(); - } - - return $this->getOwner()->with[$this->foreign_table]['model']; + // TODO this should be removed in the future + if (!isset($this->getOwner()->with[$this->foreign_table])) { + return $this->createFakeForeignModel(); } - $this->foreign_table->assertIsModel(); - - return $this->foreign_table; + return $this->getOwner()->with[$this->foreign_table]['model']; } /**