Support the ongoing development of →
Eloquent Architecture
Last updated 2 years ago.

Soft deleting, in my mind, was designed for the purpose of managing resources that are 'sensitive'.

With soft deletes, in the event that you remove a record from the table, will just put a timestamp of when that action occurred other than removing the record completely. This allows you to recall that record into 'existence' if it was wrongfully removed or just needed to be brought back for user or admin related reasons.

Soft deletes, to me, allow us to manage our user's priority resources with another layer of protection with this 'temporary removal', a trash bin so-to-speak. So, if the user removes something of theirs on accident, they can easily retrieve it from the 'trash'.

There are probably many more applications of soft deletes, but this is the main reason that I've found them useful.

Last updated 2 years ago.

Yep. SoftDeletingTrait was introduced in L 4.2. But until 4.2 the SoftDeletingTrait methods were part of the Eloquent Model class. So yes, soft deleting is awesome but since 4.2 one has to distinguish between those models that use it and those that do not. This is time-consuming if you write code that deals with models but does not demand a certain model (class). You will always have to distinguish.

Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.