@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $session = $this->sessionService->getSession($sessionId); |
60 | 60 | view()->share($this->reportService->getSessionReport($session)); |
61 | 61 | // Show the html page |
62 | - if($request->has('html')) |
|
62 | + if ($request->has('html')) |
|
63 | 63 | { |
64 | 64 | return view($this->printerService->getSessionReportPath()); |
65 | 65 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $session = $this->sessionService->getSession($sessionId); |
98 | 98 | view()->share($this->reportService->getSavingsReport($session)); |
99 | 99 | // Show the html page |
100 | - if($request->has('html')) |
|
100 | + if ($request->has('html')) |
|
101 | 101 | { |
102 | 102 | return view($this->printerService->getSavingsReportPath()); |
103 | 103 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $round = $this->roundService->getRound($roundId); |
120 | 120 | view()->share($this->reportService->getRoundReport($round)); |
121 | 121 | // Show the html page |
122 | - if($request->has('html')) |
|
122 | + if ($request->has('html')) |
|
123 | 123 | { |
124 | 124 | return view($this->printerService->getRoundReportPath()); |
125 | 125 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function getRounds(int $page = 0): Collection |
35 | 35 | { |
36 | - if(!($tontine = $this->tenantService->tontine())) |
|
36 | + if (!($tontine = $this->tenantService->tontine())) |
|
37 | 37 | { |
38 | 38 | return collect([]); |
39 | 39 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $tontine->rounds()->where('id', $roundId)->delete(); |
116 | 116 | }); |
117 | 117 | } |
118 | - catch(Exception $e) |
|
118 | + catch (Exception $e) |
|
119 | 119 | { |
120 | 120 | throw new MessageException(trans('tontine.round.errors.delete')); |
121 | 121 | } |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | $figures->cashier->recv = $cashier; |
47 | 47 | |
48 | 48 | $depositCount = !$deposit ? 0 : $deposit->total; |
49 | - $depositAmount = $pool->deposit_fixed ? $pool->amount * $depositCount : |
|
50 | - (!$deposit ? 0 : $deposit->amount); |
|
49 | + $depositAmount = $pool->deposit_fixed ? $pool->amount * $depositCount : (!$deposit ? 0 : $deposit->amount); |
|
51 | 50 | |
52 | 51 | $figures->deposit->amount += $depositAmount; |
53 | 52 | $figures->cashier->recv += $depositAmount; |
@@ -55,8 +54,7 @@ discard block |
||
55 | 54 | |
56 | 55 | $sessionCount = $pool->counter->sessions - $pool->counter->disabled_sessions; |
57 | 56 | $remitmentCount = !$remitment ? 0 : $remitment->total; |
58 | - $remitmentAmount = !$pool->deposit_fixed ? $depositAmount : |
|
59 | - $pool->amount * $sessionCount * $remitmentCount; |
|
57 | + $remitmentAmount = !$pool->deposit_fixed ? $depositAmount : $pool->amount * $sessionCount * $remitmentCount; |
|
60 | 58 | |
61 | 59 | $figures->cashier->end = $figures->cashier->recv; |
62 | 60 | $figures->remitment->amount += $remitmentAmount; |
@@ -80,9 +78,9 @@ discard block |
||
80 | 78 | { |
81 | 79 | $cashier = 0; |
82 | 80 | $collectedFigures = []; |
83 | - foreach($sessions as $session) |
|
81 | + foreach ($sessions as $session) |
|
84 | 82 | { |
85 | - if(($disabledSessions && $disabledSessions->has($session->id)) || $session->pending) |
|
83 | + if (($disabledSessions && $disabledSessions->has($session->id)) || $session->pending) |
|
86 | 84 | { |
87 | 85 | $collectedFigures[$session->id] = $this->makeFigures(' '); |
88 | 86 | continue; |
@@ -149,11 +147,10 @@ discard block |
||
149 | 147 | return $pools->map(function($pool) use($allSessions, $deposits, $remitments, $disabledSessions) { |
150 | 148 | $disabledSessions = $disabledSessions[$pool->id] ?? null; |
151 | 149 | // Enabled sessions |
152 | - $sessions = !$disabledSessions ? $allSessions : |
|
153 | - $allSessions->filter(fn($session) => !$disabledSessions->has($session->id)); |
|
150 | + $sessions = !$disabledSessions ? $allSessions : $allSessions->filter(fn($session) => !$disabledSessions->has($session->id)); |
|
154 | 151 | |
155 | 152 | $figures = new stdClass(); |
156 | - if($pool->remit_planned) |
|
153 | + if ($pool->remit_planned) |
|
157 | 154 | { |
158 | 155 | $depositCount = $pool->subscriptions()->count(); |
159 | 156 | $figures->expected = $this->getExpectedFigures($pool, $sessions, $depositCount); |
@@ -172,7 +169,7 @@ discard block |
||
172 | 169 | */ |
173 | 170 | public function getSessionRemitmentCount(Pool $pool, Session $session): int |
174 | 171 | { |
175 | - if(!$pool->deposit_fixed) |
|
172 | + if (!$pool->deposit_fixed) |
|
176 | 173 | { |
177 | 174 | return 1; |
178 | 175 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'title' => trans('common.actions.close'), |
34 | 34 | 'class' => 'btn btn-tertiary', |
35 | 35 | 'click' => 'close', |
36 | - ],[ |
|
36 | + ], [ |
|
37 | 37 | 'title' => trans('common.actions.save'), |
38 | 38 | 'class' => 'btn btn-primary', |
39 | 39 | 'click' => $this->rq()->saveTontine(pm()->select('tontine_id')->toInt()), |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | public function saveTontine(int $tontineId) |
47 | 47 | { |
48 | - if(!($tontine = $this->tontineService->getTontine($tontineId))) |
|
48 | + if (!($tontine = $this->tontineService->getTontine($tontineId))) |
|
49 | 49 | { |
50 | 50 | return $this->response; |
51 | 51 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | $this->selectTontine($tontine); |
57 | 57 | |
58 | - if(($round = $tontine->rounds->first())) |
|
58 | + if (($round = $tontine->rounds->first())) |
|
59 | 59 | { |
60 | 60 | return $this->saveRound($round->id); |
61 | 61 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | public function showRounds() |
71 | 71 | { |
72 | - if(!($tontine = $this->tenantService->tontine())) |
|
72 | + if (!($tontine = $this->tenantService->tontine())) |
|
73 | 73 | { |
74 | 74 | return $this->response; |
75 | 75 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | 'title' => trans('common.actions.close'), |
81 | 81 | 'class' => 'btn btn-tertiary', |
82 | 82 | 'click' => 'close', |
83 | - ],[ |
|
83 | + ], [ |
|
84 | 84 | 'title' => trans('common.actions.save'), |
85 | 85 | 'class' => 'btn btn-primary', |
86 | 86 | 'click' => $this->rq()->saveRound(pm()->select('round_id')->toInt()), |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | |
93 | 93 | public function saveRound(int $roundId) |
94 | 94 | { |
95 | - if(!($tontine = $this->tenantService->tontine())) |
|
95 | + if (!($tontine = $this->tenantService->tontine())) |
|
96 | 96 | { |
97 | 97 | return $this->response; |
98 | 98 | } |
99 | - if(!($round = $this->roundService->getRound($roundId))) |
|
99 | + if (!($round = $this->roundService->getRound($roundId))) |
|
100 | 100 | { |
101 | 101 | return $this->response; |
102 | 102 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | 'title' => trans('common.actions.cancel'), |
69 | 69 | 'class' => 'btn btn-tertiary', |
70 | 70 | 'click' => 'close', |
71 | - ],[ |
|
71 | + ], [ |
|
72 | 72 | 'title' => trans('common.actions.save'), |
73 | 73 | 'class' => 'btn btn-primary', |
74 | 74 | 'click' => $this->rq()->create(pm()->form('round-form')), |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'title' => trans('common.actions.cancel'), |
100 | 100 | 'class' => 'btn btn-tertiary', |
101 | 101 | 'click' => 'close', |
102 | - ],[ |
|
102 | + ], [ |
|
103 | 103 | 'title' => trans('common.actions.save'), |
104 | 104 | 'class' => 'btn btn-primary', |
105 | 105 | 'click' => $this->rq()->update($round->id, pm()->form('round-form')), |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $this->notify->success(trans('tontine.round.messages.deleted'), trans('common.titles.success')); |
129 | 129 | |
130 | 130 | $currentRound = $this->tenantService->round(); |
131 | - if($currentRound !== null && $currentRound->id === $roundId) |
|
131 | + if ($currentRound !== null && $currentRound->id === $roundId) |
|
132 | 132 | { |
133 | 133 | // If the currently selected round is deleted, then choose another. |
134 | 134 | $this->cl(Select::class)->setTenantService($this->tenantService) |
@@ -49,7 +49,7 @@ |
||
49 | 49 | public function home(int $fundId) |
50 | 50 | { |
51 | 51 | $funds = $this->fundService->getFundList(); |
52 | - if(!isset($funds[$fundId])) |
|
52 | + if (!isset($funds[$fundId])) |
|
53 | 53 | { |
54 | 54 | return $this->response; |
55 | 55 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @return Builder|Relation |
49 | 49 | */ |
50 | - private function getQuery(string $search = ''): Builder|Relation |
|
50 | + private function getQuery(string $search = ''): Builder | Relation |
|
51 | 51 | { |
52 | 52 | return $this->tenantService->tontine()->members() |
53 | 53 | ->when($this->filterActive, fn(Builder $query) => $query->active()) |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | private function saveActiveMembers() |
118 | 118 | { |
119 | - if(!($tontine = $this->tenantService->tontine()) || |
|
119 | + if (!($tontine = $this->tenantService->tontine()) || |
|
120 | 120 | !($round = $this->tenantService->round())) |
121 | 121 | { |
122 | 122 | return; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | // The number of active members is saved in the round, so its current |
137 | 137 | // value can be retrieved forever, even when the membership will change. |
138 | 138 | $round = $this->tenantService->round(); |
139 | - if(!isset($round->properties['members'])) |
|
139 | + if (!isset($round->properties['members'])) |
|
140 | 140 | { |
141 | 141 | // Create and save the property with the content |
142 | 142 | $this->saveActiveMembers(); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $tontine = $this->tenantService->tontine(); |
180 | 180 | $members = $tontine->members()->createMany($values); |
181 | 181 | // Create members bills |
182 | - foreach($members as $member) |
|
182 | + foreach ($members as $member) |
|
183 | 183 | { |
184 | 184 | $this->memberCreated($tontine, $member); |
185 | 185 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return Builder|Relation |
124 | 124 | */ |
125 | - private function getSessionsQuery($query, ?Session $currSession, bool $getAfter, bool $withCurr): Builder|Relation |
|
125 | + private function getSessionsQuery($query, ?Session $currSession, bool $getAfter, bool $withCurr): Builder | Relation |
|
126 | 126 | { |
127 | 127 | $operator = $getAfter ? ($withCurr ? '>=' : '>') : ($withCurr ? '<=' : '<'); |
128 | 128 | $currSessionDate = !$currSession ? '' : $currSession->start_at->format('Y-m-d'); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return Builder|Relation |
139 | 139 | */ |
140 | - private function getRoundSessionsQuery(?Session $currSession, bool $getAfter, bool $withCurr): Builder|Relation |
|
140 | + private function getRoundSessionsQuery(?Session $currSession, bool $getAfter, bool $withCurr): Builder | Relation |
|
141 | 141 | { |
142 | 142 | return $this->getSessionsQuery($this->getRoundSessionQuery(), $currSession, $getAfter, $withCurr); |
143 | 143 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return Builder|Relation |
179 | 179 | */ |
180 | - private function getTontineSessionsQuery(?Session $currSession, bool $getAfter, bool $withCurr): Builder|Relation |
|
180 | + private function getTontineSessionsQuery(?Session $currSession, bool $getAfter, bool $withCurr): Builder | Relation |
|
181 | 181 | { |
182 | 182 | $query = $this->tenantService->tontine()->sessions(); |
183 | 183 | return $this->getSessionsQuery($query, $currSession, $getAfter, $withCurr); |
@@ -25,11 +25,10 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return self |
27 | 27 | */ |
28 | - public function with(array|string $relation): self |
|
28 | + public function with(array | string $relation): self |
|
29 | 29 | { |
30 | 30 | $this->withs = is_string($relation) ? |
31 | - [...$this->withs, $relation] : |
|
32 | - [...$this->withs, ...$relation]; |
|
31 | + [...$this->withs, $relation] : [...$this->withs, ...$relation]; |
|
33 | 32 | return $this; |
34 | 33 | } |
35 | 34 | |
@@ -38,11 +37,10 @@ discard block |
||
38 | 37 | * |
39 | 38 | * @return self |
40 | 39 | */ |
41 | - public function withCount(array|string $relation): self |
|
40 | + public function withCount(array | string $relation): self |
|
42 | 41 | { |
43 | 42 | $this->withCounts = is_string($relation) ? |
44 | - [...$this->withCounts, $relation] : |
|
45 | - [...$this->withCounts, ...$relation]; |
|
43 | + [...$this->withCounts, $relation] : [...$this->withCounts, ...$relation]; |
|
46 | 44 | return $this; |
47 | 45 | } |
48 | 46 | |
@@ -51,7 +49,7 @@ discard block |
||
51 | 49 | * |
52 | 50 | * @return void |
53 | 51 | */ |
54 | - protected function addWith(Builder|Relation $query) |
|
52 | + protected function addWith(Builder | Relation $query) |
|
55 | 53 | { |
56 | 54 | $query->when(count($this->withs) > 0, fn() => $query->with($this->withs)) |
57 | 55 | ->when(count($this->withCounts) > 0, fn() => $query->withCount($this->withCounts)); |