cerwyn / laraser
1.0.0-beta
2021-02-25 11:59 UTC
Requires
- php: ^7.1
- doctrine/dbal: ^3.0
- illuminate/support: ^8.0
Requires (Dev)
- orchestra/testbench: ^6.12
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-10-25 20:39:48 UTC
README
Simply Hard Delete your soft deleted data
Installation
You can install the package via composer:
composer require cerwyn/laraser
Usage
- Publish the configuration
php artisan vendor:publish --tag=laraser
- The configuration should look like this
[
'remove_in' => 30, //days
'only' => [
'App\Models\User',
],
'log' => true,
'storage' => 'local'
];
The remove_in
is the old of your soft deleted data that want to be deleted.
The only
is the models that take effect. If you want to make all of your models take effect, then you should fill with ['*']
The log
is whether you want to log the data before being removed
The storage
is where you want your log to be stored. If you want to have another place to save your log data, you should add another disks inside config/filesystems.php
'disks' => [
// Add new disks
'laraser' => [
'driver' => 'local',
'root' => storage_path('app/laraser'),
],
Then inside the laraser configuration file,
'storage' => 'laraser',
- Then you can schedule the command inside
app/Console/Kernel.php
protected function schedule(Schedule $schedule)
{
$schedule->command('laraser:remove')->weekly();
}
- Or run the
php artisan laraser:remove
manually, to start removing your soft deleted data based on your configuration
License
The MIT License (MIT). Please see License File for more information.