Conditions | 5 |
Paths | 4 |
Total Lines | 27 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
19 | public function handle(): int |
||
20 | { |
||
21 | $months = (int) $this->option('months'); |
||
22 | if ($months < 0 || $months > 120) { |
||
23 | $months = null; |
||
24 | } |
||
25 | |||
26 | |||
27 | if ($this->option('property_id')) { |
||
28 | AvailabilityPull::dispatch( |
||
29 | $this->option('property_id'), |
||
30 | array_filter(['months' => $months]) |
||
31 | )->onQueue($this->option('queue')); |
||
32 | } else { |
||
33 | Property::query() |
||
34 | ->chunk(100, function ($properties) use ($months) { |
||
35 | /** @var Property $property */ |
||
36 | foreach ($properties as $property) { |
||
37 | AvailabilityPull::dispatch( |
||
38 | $property->getKey(), |
||
39 | array_filter(['months' => $months]) |
||
40 | )->onQueue($this->option('queue')); |
||
41 | } |
||
42 | }); |
||
43 | } |
||
44 | |||
45 | return 0; |
||
46 | } |
||
48 |