Conditions | 1 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | public function handle() |
||
26 | { |
||
27 | $this->comment('Cleaning activity log...'); |
||
28 | |||
29 | $maxAgeInDays = config('laravel-activitylog.delete_records_older_than_days'); |
||
30 | |||
31 | $cutOffDate = Carbon::now()->subDays($maxAgeInDays)->format('Y-m-d H:i:s'); |
||
32 | |||
33 | $amountDeleted = Activity::where('created_at', '<', $cutOffDate)->delete(); |
||
34 | |||
35 | $this->info("Deleted {$amountDeleted} record(s) from the activity log."); |
||
36 | |||
37 | $this->comment('All done!'); |
||
40 |