DEV Community

Discussion on: 23+ Laravel Interview Questions (Answered) You Should Know

Collapse
 
dansilcox profile image
Dan Silcox

Soft delete could be implemented as a scope with a filter like where deleted = false :)

Collapse
 
sambenne profile image
Sam Bennett

Wouldn't you just use the SoftDeletes Trait? It seems pointless to use scopes to do soft deletes. Plus the question says how to do Soft Deletes but does not show anything to do with it. That would be a fail in my books and would show the person can't read.

Thread Thread
 
dansilcox profile image
Dan Silcox

Fair enough - I must admit I don't do Laravel on a daily basis so wasn't aware of the SoftDeletes trait - was just working out from the context of the OP's article that they were implying scopes could be used for soft deletes...

Collapse
 
bkirev profile image
Bozhidar Kirev

I think the author just messed up the copypasta :)

Anyone who is interested in proper explanation, please refer to laravel.com/docs/6.x/eloquent#soft...

Thread Thread
 
dansilcox profile image
Dan Silcox

Ah nice thanks for the link