Laravel soft deletes optimization for high load queries
tenantcloud/laravel-boolean-softdeletes is a Laravel package for laravel soft deletes optimization for high load queries.
It currently has 27 GitHub stars and 120.377 downloads on Packagist (latest version v7.0).
Install it with composer require tenantcloud/laravel-boolean-softdeletes.
Discover more Laravel packages by tenantcloud
or browse all Laravel packages to compare alternatives.
Last updated
This package is designed for high-load applications and optimizes queries with soft deletes by utilizing a boolean field for indexing, which is more efficient than using unique timestamps.
Via Composer
$ composer require tenantcloud/laravel-boolean-softdeletes
Add Webkid\LaravelBooleanSoftdeletes\SoftDeletesBoolean trait to models with soft deletes.
Then create and run migration to add soft delete boolean field
Schema::table('users', function (Blueprint $table) {
$table->boolean('is_deleted')->default(false)->index();
});
If you want to use this package for existing project you can use built-in command
php artisan softdeletes:migrate
Also you can change default column name is_deleted to any other by setting static property IS_DELETEDof certain model
Versions compatibility
For Laravel 10 - laravel-boolean-softdeletes 5.*
For Laravel 11 - laravel-boolean-softdeletes 6.*
For Laravel 12 - laravel-boolean-softdeletes 7.*
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.