Conditions | 5 |
Paths | 1 |
Total Lines | 27 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public function handle() |
||
32 | { |
||
33 | DB::transaction(function() { |
||
34 | foreach(Tontine::cursor() as $tontine) |
||
35 | { |
||
36 | $closings = $tontine->properties['closings'] ?? []; |
||
37 | foreach($closings as $sessionId => $funds) |
||
38 | { |
||
39 | foreach($funds as $fundId => $profitAmount) |
||
40 | { |
||
41 | Closing::updateOrCreate([ |
||
42 | 'type' => Closing::TYPE_ROUND, |
||
43 | 'session_id' => $sessionId, |
||
44 | 'fund_id' => $fundId ?: $tontine->default_fund->id, |
||
45 | ], [ |
||
46 | 'options' => [ |
||
47 | 'profit' => [ |
||
48 | 'amount' => $profitAmount, |
||
49 | ], |
||
50 | ], |
||
51 | ]); |
||
52 | } |
||
53 | } |
||
54 | } |
||
55 | }); |
||
56 | |||
57 | return Command::SUCCESS; |
||
58 | } |
||
60 |