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-09-25 20:26:16 UTC
README
简单删除您的软删除数据
安装
您可以通过composer安装此包
composer require cerwyn/laraser
用法
- 发布配置
php artisan vendor:publish --tag=laraser
- 配置应如下所示
[
'remove_in' => 30, //days
'only' => [
'App\Models\User',
],
'log' => true,
'storage' => 'local'
];
remove_in
是您想要删除的旧软删除数据的时间。
only
是生效的模型。如果您想使所有模型都生效,则应填写 ['*']
log
是您是否想要在删除前记录数据。
storage
是您想要存储日志的位置。如果您想在另一个地方保存日志数据,则应在 config/filesystems.php
中添加另一个磁盘。
'disks' => [
// Add new disks
'laraser' => [
'driver' => 'local',
'root' => storage_path('app/laraser'),
],
然后,在laraser配置文件中,
'storage' => 'laraser',
- 然后在
app/Console/Kernel.php
中安排命令
protected function schedule(Schedule $schedule)
{
$schedule->command('laraser:remove')->weekly();
}
- 或手动运行
php artisan laraser:remove
以根据您的配置开始删除软删除数据
许可证
MIT许可证(MIT)。请参阅许可证文件以获取更多信息。