What are Soft Deletes in Eloquent?

Answer

Soft deletes allow you to "delete" records without actually removing them from the database — a deleted_at timestamp is set instead. To enable: add use SoftDeletes; trait to the model and add a $table->softDeletes() column to the migration. When you call $user->delete(), the deleted_at field is set to the current timestamp. Normal queries automatically filter out soft-deleted records. Include soft-deleted records: User::withTrashed()->get(). Only soft-deleted: User::onlyTrashed()->get(). Restore: $user->restore(). Permanently delete: $user->forceDelete(). Soft deletes are useful for audit trails, accidental deletion recovery, and "trash" features. The deleted_at column must be nullable.