| Conditions | 1 |
| Paths | 1 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | public function handle() |
||
| 40 | { |
||
| 41 | $this->comment('Cleaning sensordata table...'); |
||
| 42 | |||
| 43 | $maxAgeInDays = config('sensordata.delete_records_older_than_days', 365); |
||
| 44 | $cutOffDate = Carbon::now()->subDays($maxAgeInDays)->format('Y-m-d H:i:s'); |
||
| 45 | $amountDeleted = Sensordata::where('created_at', '<', $cutOffDate)->delete(); |
||
| 46 | |||
| 47 | $this->info("Deleted {$amountDeleted} record(s) from the activity log."); |
||
| 48 | |||
| 49 | $this->comment('All done!'); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.