@@ -36,13 +36,13 @@ |
||
36 | 36 | 'amount' => 'required|regex:/^\d+(\.\d{1,2})?$/', |
37 | 37 | 'deadline' => 'required|integer|min:1', |
38 | 38 | ]); |
39 | - if($validator->fails()) |
|
39 | + if ($validator->fails()) |
|
40 | 40 | { |
41 | 41 | throw new ValidationException($validator); |
42 | 42 | } |
43 | 43 | |
44 | 44 | $validated = $validator->validated(); |
45 | - $validated['amount'] = $this->localeService->convertMoneyToInt((float)$validated['amount']); |
|
45 | + $validated['amount'] = $this->localeService->convertMoneyToInt((float) $validated['amount']); |
|
46 | 46 | return $validated; |
47 | 47 | } |
48 | 48 | } |
@@ -142,8 +142,7 @@ |
||
142 | 142 | $pool->subscriptions()->delete(); |
143 | 143 | $pool->delete(); |
144 | 144 | }); |
145 | - } |
|
146 | - catch(Exception $e) |
|
145 | + } catch(Exception $e) |
|
147 | 146 | { |
148 | 147 | throw new MessageException(trans('tontine.errors.action') . |
149 | 148 | '<br/>' . trans('tontine.pool.errors.subscription')); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * @return Builder|Relation |
26 | 26 | */ |
27 | - private function getQuery(): Builder|Relation |
|
27 | + private function getQuery(): Builder | Relation |
|
28 | 28 | { |
29 | 29 | return Pool::ofRound($this->tenantService->round()); |
30 | 30 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $pool->delete(); |
123 | 123 | }); |
124 | 124 | } |
125 | - catch(Exception $e) |
|
125 | + catch (Exception $e) |
|
126 | 126 | { |
127 | 127 | throw new MessageException(trans('tontine.errors.action') . |
128 | 128 | '<br/>' . trans('tontine.pool.errors.subscription')); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | // return; |
213 | 213 | // } |
214 | 214 | $session = $pool->sessions()->find($sessionId); |
215 | - if(!$session || $session->enabled($pool)) |
|
215 | + if (!$session || $session->enabled($pool)) |
|
216 | 216 | { |
217 | 217 | return; |
218 | 218 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | // return; |
240 | 240 | // } |
241 | 241 | $session = $pool->sessions()->find($sessionId); |
242 | - if(!$session || $session->disabled($pool)) |
|
242 | + if (!$session || $session->disabled($pool)) |
|
243 | 243 | { |
244 | 244 | return; |
245 | 245 | } |
@@ -36,8 +36,7 @@ |
||
36 | 36 | */ |
37 | 37 | public function saveProperties(array $content) |
38 | 38 | { |
39 | - $this->property ? $this->property->update(['content' => $content]) : |
|
40 | - $this->property()->create(['content' => $content]); |
|
39 | + $this->property ? $this->property->update(['content' => $content]) : $this->property()->create(['content' => $content]); |
|
41 | 40 | // Refresh the relation; |
42 | 41 | $this->load('property'); |
43 | 42 | } |
@@ -155,8 +155,7 @@ |
||
155 | 155 | if($fund !== null) |
156 | 156 | { |
157 | 157 | $saving->fund()->associate($fund); |
158 | - } |
|
159 | - else |
|
158 | + } else |
|
160 | 159 | { |
161 | 160 | $saving->fund()->dissociate(); |
162 | 161 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return Builder|Relation |
38 | 38 | */ |
39 | - private function getSavingQuery(Session $session, int $fundId): Builder|Relation |
|
39 | + private function getSavingQuery(Session $session, int $fundId): Builder | Relation |
|
40 | 40 | { |
41 | 41 | // $fundId < 0 => all the savings |
42 | 42 | // $fundId === 0 => savings of the default fund |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $saving->amount = $amount; |
141 | 141 | $saving->member()->associate($member); |
142 | 142 | $saving->session()->associate($session); |
143 | - if($fund !== null) |
|
143 | + if ($fund !== null) |
|
144 | 144 | { |
145 | 145 | $saving->fund()->associate($fund); |
146 | 146 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function createSaving(Session $session, array $values): void |
163 | 163 | { |
164 | - if(!($member = $this->getMember($values['member']))) |
|
164 | + if (!($member = $this->getMember($values['member']))) |
|
165 | 165 | { |
166 | 166 | throw new MessageException(trans('tontine.member.errors.not_found')); |
167 | 167 | } |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function updateSaving(Session $session, int $savingId, array $values): void |
184 | 184 | { |
185 | - if(!($member = $this->getMember($values['member']))) |
|
185 | + if (!($member = $this->getMember($values['member']))) |
|
186 | 186 | { |
187 | 187 | throw new MessageException(trans('tontine.member.errors.not_found')); |
188 | 188 | } |
189 | 189 | $saving = $session->savings()->find($savingId); |
190 | - if(!$saving) |
|
190 | + if (!$saving) |
|
191 | 191 | { |
192 | 192 | throw new MessageException(trans('meeting.saving.errors.not_found')); |
193 | 193 | } |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function saveSaving(Session $session, int $fundId, int $memberId, int $amount): void |
210 | 210 | { |
211 | - if(!($member = $this->getMember($memberId))) |
|
211 | + if (!($member = $this->getMember($memberId))) |
|
212 | 212 | { |
213 | 213 | throw new MessageException(trans('tontine.member.errors.not_found')); |
214 | 214 | } |
215 | 215 | $fund = !$fundId ? null : $this->fundService->getFund($fundId); |
216 | 216 | $saving = $this->findSaving($session, !$fund ? 0 : $fund->id, $member->id); |
217 | - if(!$saving) |
|
217 | + if (!$saving) |
|
218 | 218 | { |
219 | 219 | $saving = new Saving(); |
220 | 220 | } |
@@ -234,8 +234,7 @@ discard block |
||
234 | 234 | public function deleteSaving(Session $session, int $savingId, int $memberId = 0): void |
235 | 235 | { |
236 | 236 | $savingId > 0 ? |
237 | - $session->savings()->where('id', $savingId)->delete() : |
|
238 | - $session->savings()->where('member_id', $memberId)->delete(); |
|
237 | + $session->savings()->where('id', $savingId)->delete() : $session->savings()->where('member_id', $memberId)->delete(); |
|
239 | 238 | } |
240 | 239 | |
241 | 240 | /** |
@@ -252,8 +251,7 @@ discard block |
||
252 | 251 | $query->where('session_id', $session->id) |
253 | 252 | ->where(function(Builder $query) use($fundId) { |
254 | 253 | $fundId > 0 ? |
255 | - $query->where('fund_id', $fundId) : |
|
256 | - $query->whereNull('fund_id'); |
|
254 | + $query->where('fund_id', $fundId) : $query->whereNull('fund_id'); |
|
257 | 255 | }); |
258 | 256 | }; |
259 | 257 | } |
@@ -267,7 +265,7 @@ discard block |
||
267 | 265 | * @return Builder|Relation |
268 | 266 | */ |
269 | 267 | private function getMembersQuery(Session $session, int $fundId, |
270 | - string $search, ?bool $filter): Builder|Relation |
|
268 | + string $search, ?bool $filter): Builder | Relation |
|
271 | 269 | { |
272 | 270 | $savingsFilter = $this->getMemberSavingsFilter($session, $fundId); |
273 | 271 | return $this->tenantService->tontine()->members()->active() |
@@ -391,10 +389,10 @@ discard block |
||
391 | 389 | { |
392 | 390 | $tontine = $this->tenantService->tontine(); |
393 | 391 | $properties = $tontine->properties; |
394 | - if(isset($properties['closings'][$session->id][$fundId])) |
|
392 | + if (isset($properties['closings'][$session->id][$fundId])) |
|
395 | 393 | { |
396 | 394 | unset($properties['closings'][$session->id][$fundId]); |
397 | - if(count($properties['closings'][$session->id]) == 0) |
|
395 | + if (count($properties['closings'][$session->id]) == 0) |
|
398 | 396 | { |
399 | 397 | unset($properties['closings'][$session->id]); |
400 | 398 | } |
@@ -228,8 +228,7 @@ |
||
228 | 228 | if($fund !== null) |
229 | 229 | { |
230 | 230 | $loan->fund()->associate($fund); |
231 | - } |
|
232 | - else |
|
231 | + } else |
|
233 | 232 | { |
234 | 233 | $loan->fund()->dissociate(); |
235 | 234 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $loan->interest_rate = $values['interest_rate']; |
139 | 139 | $loan->member()->associate($member); |
140 | 140 | $loan->session()->associate($session); |
141 | - if($fund !== null) |
|
141 | + if ($fund !== null) |
|
142 | 142 | { |
143 | 143 | $loan->fund()->associate($fund); |
144 | 144 | } |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | $principal = $values['principal']; |
149 | 149 | $interest = $values['interest']; |
150 | 150 | // Create an entry for each type of debt |
151 | - if($principal > 0) |
|
151 | + if ($principal > 0) |
|
152 | 152 | { |
153 | 153 | $loan->debts()->create(['type' => Debt::TYPE_PRINCIPAL, 'amount' => $principal]); |
154 | 154 | } |
155 | - if($interest > 0) |
|
155 | + if ($interest > 0) |
|
156 | 156 | { |
157 | 157 | $loan->debts()->create(['type' => Debt::TYPE_INTEREST, 'amount' => $interest]); |
158 | 158 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $loan->interest_type = $values['interest_type']; |
176 | 176 | $loan->interest_rate = $values['interest_rate']; |
177 | 177 | $loan->member()->associate($member); |
178 | - if($fund !== null) |
|
178 | + if ($fund !== null) |
|
179 | 179 | { |
180 | 180 | $loan->fund()->associate($fund); |
181 | 181 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $interest = $values['interest']; |
191 | 191 | $loan->debts()->principal()->update(['amount' => $principal]); |
192 | 192 | // The interest debt may need to be created or deleted. |
193 | - if($interest <= 0) |
|
193 | + if ($interest <= 0) |
|
194 | 194 | { |
195 | 195 | $loan->debts()->where('type', Debt::TYPE_INTEREST)->delete(); |
196 | 196 | return; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function deleteLoan(Session $session, int $loanId): void |
211 | 211 | { |
212 | - if(($loan = $session->loans()->find($loanId)) !== null) |
|
212 | + if (($loan = $session->loans()->find($loanId)) !== null) |
|
213 | 213 | { |
214 | 214 | DB::transaction(function() use($loan) { |
215 | 215 | $loan->refunds()->delete(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'fund_id' => 'required|integer|min:0', |
33 | 33 | ]); |
34 | 34 | $validator->after(function($validator) use($values) { |
35 | - if((float)$values['principal'] <= 0) |
|
35 | + if ((float) $values['principal'] <= 0) |
|
36 | 36 | { |
37 | 37 | $validator->errors()->add('principal', trans('validation.gt.numeric', [ |
38 | 38 | 'attribute' => trans('meeting.loan.labels.principal'), |
@@ -40,19 +40,18 @@ discard block |
||
40 | 40 | ])); |
41 | 41 | } |
42 | 42 | }); |
43 | - if($validator->fails()) |
|
43 | + if ($validator->fails()) |
|
44 | 44 | { |
45 | 45 | throw new ValidationException($validator); |
46 | 46 | } |
47 | 47 | |
48 | 48 | $validated = $validator->validated(); |
49 | - $validated['principal'] = $this->localeService->convertMoneyToInt((float)$validated['principal']); |
|
49 | + $validated['principal'] = $this->localeService->convertMoneyToInt((float) $validated['principal']); |
|
50 | 50 | // Interest rates must be saved as int, so the value is multiplied by 100. |
51 | 51 | $validated['interest_rate'] = $validated['interest_type'] === 'f' ? |
52 | - 0 : (int)(100 * $validated['interest']); |
|
52 | + 0 : (int) (100 * $validated['interest']); |
|
53 | 53 | $validated['interest'] = $validated['interest_type'] === 'f' ? |
54 | - $this->localeService->convertMoneyToInt((float)$validated['interest']) : |
|
55 | - (int)($validated['principal'] * $validated['interest'] / 100); |
|
54 | + $this->localeService->convertMoneyToInt((float) $validated['interest']) : (int) ($validated['principal'] * $validated['interest'] / 100); |
|
56 | 55 | |
57 | 56 | return $validated; |
58 | 57 | } |
@@ -32,13 +32,13 @@ |
||
32 | 32 | $validator = Validator::make($this->values($values), [ |
33 | 33 | 'amount' => 'required|regex:/^\d+(\.\d{1,2})?$/', |
34 | 34 | ]); |
35 | - if($validator->fails()) |
|
35 | + if ($validator->fails()) |
|
36 | 36 | { |
37 | 37 | throw new ValidationException($validator); |
38 | 38 | } |
39 | 39 | |
40 | 40 | $validated = $validator->validated(); |
41 | - $validated['amount'] = $this->localeService->convertMoneyToInt((float)$validated['amount']); |
|
41 | + $validated['amount'] = $this->localeService->convertMoneyToInt((float) $validated['amount']); |
|
42 | 42 | return $validated; |
43 | 43 | } |
44 | 44 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | 'title' => trans('common.actions.cancel'), |
59 | 59 | 'class' => 'btn btn-tertiary', |
60 | 60 | 'click' => 'close', |
61 | - ],[ |
|
61 | + ], [ |
|
62 | 62 | 'title' => trans('common.actions.save'), |
63 | 63 | 'class' => 'btn btn-primary', |
64 | 64 | 'click' => $this->rq()->create(pm()->form('fund-form')), |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | 'title' => trans('common.actions.cancel'), |
90 | 90 | 'class' => 'btn btn-tertiary', |
91 | 91 | 'click' => 'close', |
92 | - ],[ |
|
92 | + ], [ |
|
93 | 93 | 'title' => trans('common.actions.save'), |
94 | 94 | 'class' => 'btn btn-primary', |
95 | 95 | 'click' => $this->rq()->update($fund->id, pm()->form('fund-form')), |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | 'title' => trans('common.actions.cancel'), |
65 | 65 | 'class' => 'btn btn-tertiary', |
66 | 66 | 'click' => 'close', |
67 | - ],[ |
|
67 | + ], [ |
|
68 | 68 | 'title' => trans('common.actions.save'), |
69 | 69 | 'class' => 'btn btn-primary', |
70 | 70 | 'click' => $this->rq()->create(pm()->form('category-form')), |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | 'title' => trans('common.actions.cancel'), |
102 | 102 | 'class' => 'btn btn-tertiary', |
103 | 103 | 'click' => 'close', |
104 | - ],[ |
|
104 | + ], [ |
|
105 | 105 | 'title' => trans('common.actions.save'), |
106 | 106 | 'class' => 'btn btn-primary', |
107 | 107 | 'click' => $this->rq()->update($category->id, pm()->form('category-form')), |