Stars: 287
Forks: 19
Pull Requests: 28
Issues: 13
Watchers: 19
Last Updated: 2023-07-31 03:46:34
Easily schedule regular cleanup of old soft-deleted Eloquent data.
License: MIT License
Languages: PHP
Schedule a force delete of your soft deleted Eloquent models or pivot tables after they've been soft deleted for a given period of time.
Quicksand is an Artisan command that you can run in your scheduler daily.
2.0 of this package.1.0 of this package.0.2 of this package.Add Quicksand to your Composer file: composer require tightenco/quicksand
Register the Quicksand Service provider in config/app.php (you can skip this step if you're using Laravel 5.5 or higher due to package auto-discovery):
'providers' => [
...
Tightenco\Quicksand\QuicksandServiceProvider::class,Publish your config: php artisan vendor:publish --provider="Tightenco\Quicksand\QuicksandServiceProvider"
Edit your config. Define which classes and/or pivot tables you'd like to have Quicksand clean up for you, how many days Quicksand should wait to clean up, and whether or not the results should be logged. The default 'days' until cleaning up is overridable by specifying a 'days' key when registering a model or pivot table:
deletables configuration key was named models and did not support pivot tables.'days' => 30,
'deletables' => [
App\Default::class,
App\CleanEveryTwentyDays::class => [
'days' => 20 // override default 'days'
],
'example_pivot',
'example_pivot' => [
'days' => 20 // override default 'days'
]
]Schedule the command in app/Console/Kernel.php:
protected function schedule(Schedule $schedule)
{
$schedule->command('quicksand:run')
->daily();
}If you are using Laravel 5.6 or higher, you can customize the logger Quicksand uses by adding a quicksand channel to your logging.php config file like so:
'channels' => [
/* ... */
'quicksand' => [
'driver' => 'single',
'path' => storage_path('logs/quicksand.log'),
'level' => 'info',
],
]If you are using Laravel 5.5 or lower, you can customize the logger Quicksand uses by editing the custom_log_file option in your quicksand.php config file.
By default, Quicksand will log to the standard laravel.log file.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
This package is developed and maintained by Tighten.
You can test this package by running
composer test
This project is licensed under the MIT License - see the LICENSE.md file for details