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

[5.2] Add withoutTrashed method to SoftDeletingScope #14805

Merged
merged 2 commits into from
Aug 15, 2016

Conversation

mnabialek
Copy link
Contributor

Sometimes it's useful to exclude trashed records when withTrashed scope has been already applied.

Let's assume we have some complex list and data returned depends on user role. By default we allow to display all the users also trashed data, but for user with role Client we won't to allow this. So we can either to repeat withTrashed for all roles except Client or we can just use withTrashed globally and then for user with role Client use ->whereNull('deleted_at'). It would be better to use withoutTrashed proposed here than manually adding such condition to query.

@taylorotwell taylorotwell merged commit daa3a28 into laravel:5.2 Aug 15, 2016
tillkruss pushed a commit to tillkruss/framework that referenced this pull request Aug 30, 2016
* Add withoutTrashed method to SoftDeletingScope

* Apply StyleCI patch
@mnabialek mnabialek deleted the 5.2-withoutTrashed branch November 5, 2017 17:02
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