| Conditions | 1 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function handle() |
||
| 26 | { |
||
| 27 | $maxAgeInDays = $this->argument('days'); |
||
| 28 | |||
| 29 | $this->comment("Cleaning schedule log, but keeping the records of the last {$maxAgeInDays} days..."); |
||
| 30 | |||
| 31 | $cutOffDate = Carbon::now()->subDays($maxAgeInDays)->format('Y-m-d H:i:s'); |
||
| 32 | |||
| 33 | $amountDeleted = Schedulelog::where('created_at', '<', $cutOffDate)->delete(); |
||
| 34 | |||
| 35 | $this->info("Deleted {$amountDeleted} record(s) from the schedule log."); |
||
| 36 | |||
| 37 | $this->comment('All done!'); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |