Soft Deletes in Laravel — a practical guide to Laravel soft delete with clear examples you can reuse in real projects.
Laravel Tutorial Series (15/27). Prefer one page? Read the complete Laravel tutorial (all 27 topics).
Short description
Soft deletes set a `deleted_at` timestamp instead of permanently removing a row.
Migration
$table->softDeletes();
Model
use IlluminateDatabaseEloquentSoftDeletes;
class Post extends Model
{
use SoftDeletes;
}
Delete / restore
$post->delete(); // soft delete
$post->restore(); // undo
$post->forceDelete(); // permanent
Query trashed
$trashed = Post::onlyTrashed()->get();
$withTrashed = Post::withTrashed()->find(1);