Support the ongoing development of Laravel.io →
Eloquent Architecture
Last updated 8 months ago.
0

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 8 months ago.
0

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 8 months ago.
0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2023 Laravel.io - All rights reserved.