diff --git a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php b/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php index edc630d6abaf..4c9fac593192 100755 --- a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php +++ b/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php @@ -423,7 +423,7 @@ public function findOrFail($id, $columns = ['*']) return $result; } - throw (new ModelNotFoundException)->setModel(get_class($this->parent)); + throw (new ModelNotFoundException)->setModel(get_class($this->related)); } /** @@ -453,7 +453,7 @@ public function firstOrFail($columns = ['*']) return $model; } - throw (new ModelNotFoundException)->setModel(get_class($this->parent)); + throw (new ModelNotFoundException)->setModel(get_class($this->related)); } /** diff --git a/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php b/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php index 19071b429e2a..3fb7a7cc255e 100644 --- a/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php +++ b/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php @@ -247,7 +247,7 @@ public function firstOrFail($columns = ['*']) return $model; } - throw (new ModelNotFoundException)->setModel(get_class($this->parent)); + throw (new ModelNotFoundException)->setModel(get_class($this->related)); } /**