Skip to content

Conversation

mmachatschek
Copy link
Contributor

This is a followup to PR #36200 if no model exists on a e.g. BelongsToMany relation the ::$model property doesn't exist.

The findOrFail() method on the BelongsToMany::class also uses the ::$related property to set the model on the ModelNotFoundException https://github.com/laravel/framework/blob/8.x/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php#L702

@mmachatschek mmachatschek changed the title Fix undefined property with sole query [8.x] Fix undefined property with sole query Feb 10, 2021
@taylorotwell taylorotwell merged commit 1e0549a into laravel:8.x Feb 10, 2021
@mmachatschek mmachatschek deleted the fix_sole_relation_exception branch February 10, 2021 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants