Laravel

Laravel Eloquent: Soft Deletes

January 16, 2026 1 min read 52 views

Soft deletes:

Add to Model

use SoftDeletes;

protected $dates = ['deleted_at'];

Migration

$table->softDeletes();

Query Soft Deleted

User::withTrashed()->get();
User::onlyTrashed()->get();

Restore

$user->restore();

Force Delete

$user->forceDelete();

Check if Trashed

if ($user->trashed()) {
    // Soft deleted
}
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!