one23 / laravel-softdeletes-boolean
Laravel 9 soft deletes optimization for high load queries
Requires
- php: >=8
- illuminate/console: >=v9
- illuminate/database: >=v9
- illuminate/support: >=v9
Requires (Dev)
- laravel/pint: ~v1.13
- phpstan/phpstan: ~1.10
README
This package is mostly for high load apps. It will speed up queries with soft deletes. Boolean field is much better for indexing instead of unique timestamps.
Install
Via Composer
$ composer require one23/laravel-softdeletes-boolean
Add One23\LaravelSoftDeletesBoolean\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(0)->index(); });
If you want to use this package for existing project you can use built-in command
php artisan softdeletes-boolean:migrate
Also you can change default column name is_deleted
to any other by setting static property IS_DELETED
of certain model
Versions compatibility
For Laravel 9 - laravel-softdeletes-boolean v1.*
Change log
Please see CHANGELOG for more information on what has changed recently.
Security
If you discover any security related issues, please email eugene@krivoruchko.info instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.