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

[9.x] only load trashed models on relevant routes #44478

Merged
merged 1 commit into from
Oct 5, 2022

Conversation

browner12
Copy link
Contributor

As I was writing the docs for #44405, I came to the realization it didn't make a lot of sense to load trashed models for some of the default resource routes. This PR will make it so calling ->withTrashed() with no arguments only loads trashed models on the show, edit, and update routes.

  • index, create, and store don't use route model binding, so from a performance and simplicity standpoint, we don't need to load those routes with trashed models
  • it doesn't make a lot of sense to load soft deleted models on the destroy route.

Curious to hear if there'd be any argument for continuing to load soft deleted models on the destroy route.

If this gets merged before next Tuesday's release we'll be okay keeping this on 9.x, since it's technically a breaking change.

If this gets merged I'll need to make a minor adjustment to laravel/docs#8277

- `index`, `create`, and `store` don't use route model binding, so from a performance and simplicity standpoint, we don't need to load those routes with trashed models
- it doesn't make a lot of sense to load soft deleted models on the `destroy` route.
@taylorotwell taylorotwell merged commit 5cc435d into laravel:9.x Oct 5, 2022
@browner12 browner12 deleted the trashed-resources branch October 5, 2022 16:01
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