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

[11.x] Add forceDestroy to SoftDeletes #52432

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

jasonmccreary
Copy link
Contributor

When working with a soft deleted model the other day, I reached for forceDestroy but it wasn't there. I thought this might be a good addition to the SoftDeletes trait.

Before

$comment = Comment::find(1);
$comment->forceDelete();

After

Comment::forceDestroy(1);

Similar to Model::destroy(), you may also pass forceDestroy an array or collection of ids, as well as an Eloquent collection of models to force destroy.

@driesvints driesvints changed the title Add forceDestroy to SoftDeletes [11.x] Add forceDestroy to SoftDeletes Aug 9, 2024
@taylorotwell taylorotwell merged commit cc31ca2 into laravel:11.x Aug 13, 2024
29 checks passed
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