How to use soft delete in laravel?
Soft delete is a laravel feature that helps When models are soft deleted, they are not actually removed from our database. Instead, a deleted_at timestamp is set on the record. To enable soft deletes for a model, we have to specify the soft delete property on the model like this.
In model we have to use namespace
and we can use this
use SoftDeletes; in our model property.
After that when we will use delete() query then records will not remove from our database. then a deleted_at timestamp is set on the record.
BY Best Interview Question ON 02 Mar 2023