| Conditions | 4 |
| Paths | 3 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace JobApis\JobsToMail\Console\Commands; |
||
| 47 | public function handle() |
||
| 48 | { |
||
| 49 | $count = 0; |
||
| 50 | if ($id = $this->option('id')) { |
||
| 51 | $this->notifications->where("id", $id)->delete(); |
||
| 52 | $count++; |
||
| 53 | } else { |
||
| 54 | $results = $this->notifications->where("created_at", "<", Carbon::now()->subDays(7))->get(); |
||
| 55 | if ($results) { |
||
| 56 | foreach ($results as $notification) { |
||
| 57 | $notification->delete(); |
||
| 58 | $count++; |
||
| 59 | } |
||
| 60 | } |
||
| 61 | } |
||
| 62 | return $this->info("{$count} notifications deleted."); |
||
| 63 | } |
||
| 64 | } |
||
| 65 |
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.