@@ -36,13 +36,13 @@ |
||
| 36 | 36 | 'amount' => 'required|regex:/^\d+(\.\d{1,2})?$/', |
| 37 | 37 | 'comment' => 'present|between:0,150', |
| 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 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | protected function values(array $values): array |
| 19 | 19 | { |
| 20 | 20 | return array_map(function($value) { |
| 21 | - if(!is_string($value)) |
|
| 21 | + if (!is_string($value)) |
|
| 22 | 22 | { |
| 23 | 23 | return $value; |
| 24 | 24 | } |
@@ -35,12 +35,11 @@ |
||
| 35 | 35 | { |
| 36 | 36 | $icon = '<i class="fa fa-toggle-off"></i>'; |
| 37 | 37 | $linkClass = "btn-add-$name"; |
| 38 | - if(($payment)) |
|
| 38 | + if (($payment)) |
|
| 39 | 39 | { |
| 40 | 40 | $icon = '<i class="fa fa-toggle-on"></i>'; |
| 41 | 41 | $linkClass = "btn-del-$name"; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - return $disableLink ? $icon : |
|
| 45 | - '<a href="javascript:void(0)" class="' . $linkClass . '">' . $icon . '</a>'; |
|
| 44 | + return $disableLink ? $icon : '<a href="javascript:void(0)" class="' . $linkClass . '">' . $icon . '</a>'; |
|
| 46 | 45 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function addSettlement(int $billId) |
| 118 | 118 | { |
| 119 | - if($this->session->closed) |
|
| 119 | + if ($this->session->closed) |
|
| 120 | 120 | { |
| 121 | 121 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 122 | 122 | return $this->response; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function delSettlement(int $billId) |
| 137 | 137 | { |
| 138 | - if($this->session->closed) |
|
| 138 | + if ($this->session->closed) |
|
| 139 | 139 | { |
| 140 | 140 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 141 | 141 | return $this->response; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function addSettlement(int $billId) |
| 124 | 124 | { |
| 125 | - if($this->session->closed) |
|
| 125 | + if ($this->session->closed) |
|
| 126 | 126 | { |
| 127 | 127 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 128 | 128 | return $this->response; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function delSettlement(int $billId) |
| 146 | 146 | { |
| 147 | - if($this->session->closed) |
|
| 147 | + if ($this->session->closed) |
|
| 148 | 148 | { |
| 149 | 149 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 150 | 150 | return $this->response; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function addAllSettlements() |
| 166 | 166 | { |
| 167 | - if($this->session->closed) |
|
| 167 | + if ($this->session->closed) |
|
| 168 | 168 | { |
| 169 | 169 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 170 | 170 | return $this->response; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function delAllSettlements() |
| 186 | 186 | { |
| 187 | - if($this->session->closed) |
|
| 187 | + if ($this->session->closed) |
|
| 188 | 188 | { |
| 189 | 189 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 190 | 190 | return $this->response; |
@@ -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 | } |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | private function getLatestTontine(User $user): ?Tontine |
| 41 | 41 | { |
| 42 | 42 | $tontineId = session('tontine.id', 0); |
| 43 | - if($tontineId > 0 && ($tontine = $user->tontines()->find($tontineId)) !== null) |
|
| 43 | + if ($tontineId > 0 && ($tontine = $user->tontines()->find($tontineId)) !== null) |
|
| 44 | 44 | { |
| 45 | 45 | return $tontine; |
| 46 | 46 | } |
| 47 | 47 | $tontineId = $user->properties['latest']['tontine'] ?? 0; |
| 48 | - if($tontineId > 0 && ($tontine = $user->tontines()->find($tontineId)) !== null) |
|
| 48 | + if ($tontineId > 0 && ($tontine = $user->tontines()->find($tontineId)) !== null) |
|
| 49 | 49 | { |
| 50 | 50 | return $tontine; |
| 51 | 51 | } |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | private function getLatestRound(Tontine $tontine): ?Round |
| 63 | 63 | { |
| 64 | 64 | $roundId = session('round.id', 0); |
| 65 | - if($roundId > 0 && ($round = $tontine->rounds()->find($roundId)) !== null) |
|
| 65 | + if ($roundId > 0 && ($round = $tontine->rounds()->find($roundId)) !== null) |
|
| 66 | 66 | { |
| 67 | 67 | return $round; |
| 68 | 68 | } |
| 69 | 69 | $roundId = $tontine->user->properties['latest']['round'] ?? 0; |
| 70 | - if($roundId > 0 && ($round = $tontine->rounds()->find($roundId)) !== null) |
|
| 70 | + if ($roundId > 0 && ($round = $tontine->rounds()->find($roundId)) !== null) |
|
| 71 | 71 | { |
| 72 | 72 | return $round; |
| 73 | 73 | } |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $tontineId = 0; |
| 92 | 92 | $roundId = 0; |
| 93 | - if(($tontine = $this->getLatestTontine($user)) !== null) |
|
| 93 | + if (($tontine = $this->getLatestTontine($user)) !== null) |
|
| 94 | 94 | { |
| 95 | 95 | $tontineId = $tontine->id; |
| 96 | 96 | $this->tenantService->setTontine($tontine); |
| 97 | - if(($round = $this->getLatestRound($tontine)) !== null) |
|
| 97 | + if (($round = $this->getLatestRound($tontine)) !== null) |
|
| 98 | 98 | { |
| 99 | 99 | $roundId = $round->id; |
| 100 | 100 | $this->tenantService->setRound($round); |
@@ -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 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getDisbursedAmounts(Collection $chargeIds, Collection $sessionIds): Collection |
| 113 | 113 | { |
| 114 | - if($chargeIds->count() === 0) |
|
| 114 | + if ($chargeIds->count() === 0) |
|
| 115 | 115 | { |
| 116 | 116 | return collect(); |
| 117 | 117 | } |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | $charges = $this->tenantService->tontine()->charges()->active()->get(); |
| 227 | 227 | $disbursements = $this->getDisbursedAmounts($charges->pluck('id'), $sessionIds); |
| 228 | - if($member !== null) |
|
| 228 | + if ($member !== null) |
|
| 229 | 229 | { |
| 230 | 230 | // The disbursement part of each member id calculated by dividing each amount |
| 231 | 231 | // by the number of members. |
| 232 | 232 | $memberCount = $this->memberService->countActiveMembers(); |
| 233 | - foreach($disbursements as $disbursement) |
|
| 233 | + foreach ($disbursements as $disbursement) |
|
| 234 | 234 | { |
| 235 | 235 | $disbursement->total_amount /= $memberCount; |
| 236 | 236 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | ->groupBy('debts.type') |
| 259 | 259 | ->pluck('total_amount', 'type'); |
| 260 | 260 | |
| 261 | - return (object)[ |
|
| 261 | + return (object) [ |
|
| 262 | 262 | 'principal' => $loan[Debt::TYPE_PRINCIPAL] ?? 0, |
| 263 | 263 | 'interest' => $loan[Debt::TYPE_INTEREST] ?? 0, |
| 264 | 264 | ]; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | ->groupBy('debts.type') |
| 284 | 284 | ->pluck('total_amount', 'type'); |
| 285 | 285 | |
| 286 | - return (object)[ |
|
| 286 | + return (object) [ |
|
| 287 | 287 | 'principal' => ($refund[Debt::TYPE_PRINCIPAL] ?? 0) + |
| 288 | 288 | ($partialRefund[Debt::TYPE_PRINCIPAL] ?? 0), |
| 289 | 289 | 'interest' => ($refund[Debt::TYPE_INTEREST] ?? 0) + |
@@ -302,11 +302,11 @@ discard block |
||
| 302 | 302 | ->select(DB::raw('sum(amount) as total_amount'), DB::raw('count(id) as total_count')) |
| 303 | 303 | ->where('session_id', $session->id) |
| 304 | 304 | ->first(); |
| 305 | - if(!$saving->total_amount) |
|
| 305 | + if (!$saving->total_amount) |
|
| 306 | 306 | { |
| 307 | 307 | $saving->total_amount = 0; |
| 308 | 308 | } |
| 309 | - if(!$saving->total_count) |
|
| 309 | + if (!$saving->total_count) |
|
| 310 | 310 | { |
| 311 | 311 | $saving->total_count = 0; |
| 312 | 312 | } |
@@ -325,11 +325,11 @@ discard block |
||
| 325 | 325 | ->select(DB::raw('sum(amount) as total_amount'), DB::raw('count(id) as total_count')) |
| 326 | 326 | ->where('session_id', $session->id) |
| 327 | 327 | ->first(); |
| 328 | - if(!$disbursement->total_amount) |
|
| 328 | + if (!$disbursement->total_amount) |
|
| 329 | 329 | { |
| 330 | 330 | $disbursement->total_amount = 0; |
| 331 | 331 | } |
| 332 | - if(!$disbursement->total_count) |
|
| 332 | + if (!$disbursement->total_count) |
|
| 333 | 333 | { |
| 334 | 334 | $disbursement->total_count = 0; |
| 335 | 335 | } |