gaspertrix/laravel-boolean-softdeletes

Laravel soft deletes optimization for high load queries

Downloads

95

Stars

0

Version

1.0.0

Laravel 5.5 boolean softdeletes

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

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 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(0)->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

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Gaspertrix

Author

Gaspertrix