Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] withTrashed on routes check if SoftDeletes is used in Model #39958

Merged
merged 3 commits into from
Dec 10, 2021
Merged

[8.x] withTrashed on routes check if SoftDeletes is used in Model #39958

merged 3 commits into from
Dec 10, 2021

Conversation

Slubby
Copy link
Contributor

@Slubby Slubby commented Dec 9, 2021

When using withTrashed() on a route with two bind models and one model doesn't have SoftDeletes its throws a BadMethodCallException

For example, you have a route like this:

Route::put('admin/articles/(article)/comments/{comment}/restore')->withTrashed()

The article model doesn't have SoftDeletes but the comment model has. When you want to restore the comment now its throws an exception because the model article doesn't have SoftDeletes

@taylorotwell taylorotwell merged commit cf00a56 into laravel:8.x Dec 10, 2021
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