@@ -62,19 +62,19 @@ discard block |
||
| 62 | 62 | // The select('bills.*') is important here, otherwise Eloquent overrides the |
| 63 | 63 | // Bill model id fields with those of another model, then making the dataset incorrect. |
| 64 | 64 | $query = Bill::select('bills.*'); |
| 65 | - if($charge->is_variable) |
|
| 65 | + if ($charge->is_variable) |
|
| 66 | 66 | { |
| 67 | 67 | return $query->join('libre_bills', 'libre_bills.bill_id', '=', 'bills.id') |
| 68 | 68 | ->where('libre_bills.charge_id', $charge->id) |
| 69 | 69 | ->where('libre_bills.session_id', $session->id); |
| 70 | 70 | } |
| 71 | - if($charge->period_session) |
|
| 71 | + if ($charge->period_session) |
|
| 72 | 72 | { |
| 73 | 73 | return $query->join('session_bills', 'session_bills.bill_id', '=', 'bills.id') |
| 74 | 74 | ->where('session_bills.charge_id', $charge->id) |
| 75 | 75 | ->where('session_bills.session_id', $session->id); |
| 76 | 76 | } |
| 77 | - if($charge->period_round) |
|
| 77 | + if ($charge->period_round) |
|
| 78 | 78 | { |
| 79 | 79 | return $query->join('round_bills', 'round_bills.bill_id', '=', 'bills.id') |
| 80 | 80 | ->where('round_bills.charge_id', $charge->id); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $bill = $this->getQuery($charge, $session)->with('settlement')->find($billId); |
| 99 | 99 | // Return if the bill is not found or the bill is already settled. |
| 100 | - if(!$bill || ($bill->settlement)) |
|
| 100 | + if (!$bill || ($bill->settlement)) |
|
| 101 | 101 | { |
| 102 | 102 | throw new MessageException(trans('tontine.bill.errors.not_found')); |
| 103 | 103 | } |
@@ -120,11 +120,11 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $bill = $this->getQuery($charge, $session)->with('settlement')->find($billId); |
| 122 | 122 | // Return if the bill is not found or the bill is not settled. |
| 123 | - if(!$bill || !($bill->settlement)) |
|
| 123 | + if (!$bill || !($bill->settlement)) |
|
| 124 | 124 | { |
| 125 | 125 | throw new MessageException(trans('tontine.bill.errors.not_found')); |
| 126 | 126 | } |
| 127 | - if((!$bill->settlement->editable)) |
|
| 127 | + if ((!$bill->settlement->editable)) |
|
| 128 | 128 | { |
| 129 | 129 | throw new MessageException(trans('tontine.errors.editable')); |
| 130 | 130 | } |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | public function createAllSettlements(Charge $charge, Session $session): void |
| 143 | 143 | { |
| 144 | 144 | $bills = $this->getQuery($charge, $session)->whereDoesntHave('settlement')->get(); |
| 145 | - if($bills->count() === 0) |
|
| 145 | + if ($bills->count() === 0) |
|
| 146 | 146 | { |
| 147 | 147 | return; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | DB::transaction(function() use($bills, $session) { |
| 151 | - foreach($bills as $bill) |
|
| 151 | + foreach ($bills as $bill) |
|
| 152 | 152 | { |
| 153 | 153 | $settlement = new Settlement(); |
| 154 | 154 | $settlement->bill()->associate($bill); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | ->filter(function($bill) { |
| 176 | 176 | return $bill->settlement->editable; |
| 177 | 177 | }); |
| 178 | - if($bills->count() === 0) |
|
| 178 | + if ($bills->count() === 0) |
|
| 179 | 179 | { |
| 180 | 180 | return; |
| 181 | 181 | } |
@@ -193,9 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function getSettlement(Charge $charge, Session $session): object |
| 195 | 195 | { |
| 196 | - $billTable = $charge->is_variable ? 'libre_bills' : |
|
| 197 | - ($charge->period_session ? 'session_bills' : |
|
| 198 | - ($charge->period_round ? 'round_bills' : 'tontine_bills')); |
|
| 196 | + $billTable = $charge->is_variable ? 'libre_bills' : ($charge->period_session ? 'session_bills' : ($charge->period_round ? 'round_bills' : 'tontine_bills')); |
|
| 199 | 197 | |
| 200 | 198 | return DB::table('settlements') |
| 201 | 199 | ->select(DB::raw('count(*) as total'), DB::raw('sum(bills.amount) as amount')) |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | public function createDeposit(Pool $pool, Session $session, int $receivableId): void |
| 124 | 124 | { |
| 125 | 125 | $receivable = $this->getReceivable($pool, $session, $receivableId); |
| 126 | - if(!$receivable || $receivable->deposit || !$pool->deposit_fixed) |
|
| 126 | + if (!$receivable || $receivable->deposit || !$pool->deposit_fixed) |
|
| 127 | 127 | { |
| 128 | 128 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
| 129 | 129 | } |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | public function saveDepositAmount(Pool $pool, Session $session, int $receivableId, int $amount): void |
| 148 | 148 | { |
| 149 | 149 | $receivable = $this->getReceivable($pool, $session, $receivableId); |
| 150 | - if(!$receivable || $pool->deposit_fixed) |
|
| 150 | + if (!$receivable || $pool->deposit_fixed) |
|
| 151 | 151 | { |
| 152 | 152 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if($receivable->deposit !== null) |
|
| 155 | + if ($receivable->deposit !== null) |
|
| 156 | 156 | { |
| 157 | - if((!$receivable->deposit->editable)) |
|
| 157 | + if ((!$receivable->deposit->editable)) |
|
| 158 | 158 | { |
| 159 | 159 | throw new MessageException(trans('tontine.errors.editable')); |
| 160 | 160 | } |
@@ -183,11 +183,11 @@ discard block |
||
| 183 | 183 | public function deleteDeposit(Pool $pool, Session $session, int $receivableId): void |
| 184 | 184 | { |
| 185 | 185 | $receivable = $this->getReceivable($pool, $session, $receivableId); |
| 186 | - if(!$receivable || !$receivable->deposit) |
|
| 186 | + if (!$receivable || !$receivable->deposit) |
|
| 187 | 187 | { |
| 188 | 188 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
| 189 | 189 | } |
| 190 | - if((!$receivable->deposit->editable)) |
|
| 190 | + if ((!$receivable->deposit->editable)) |
|
| 191 | 191 | { |
| 192 | 192 | throw new MessageException(trans('tontine.errors.editable')); |
| 193 | 193 | } |
@@ -205,13 +205,13 @@ discard block |
||
| 205 | 205 | public function createAllDeposits(Pool $pool, Session $session): void |
| 206 | 206 | { |
| 207 | 207 | $receivables = $this->getQuery($pool, $session)->whereDoesntHave('deposit')->get(); |
| 208 | - if($receivables->count() === 0) |
|
| 208 | + if ($receivables->count() === 0) |
|
| 209 | 209 | { |
| 210 | 210 | return; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | DB::transaction(function() use($session, $receivables) { |
| 214 | - foreach($receivables as $receivable) |
|
| 214 | + foreach ($receivables as $receivable) |
|
| 215 | 215 | { |
| 216 | 216 | $deposit = new Deposit(); |
| 217 | 217 | $deposit->receivable()->associate($receivable); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | ->filter(function($receivable) { |
| 239 | 239 | return $receivable->deposit->editable; |
| 240 | 240 | }); |
| 241 | - if($receivables->count() === 0) |
|
| 241 | + if ($receivables->count() === 0) |
|
| 242 | 242 | { |
| 243 | 243 | return; |
| 244 | 244 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function getDisbursedAmounts(Collection $chargeIds, Collection $sessionIds): Collection |
| 121 | 121 | { |
| 122 | - if($chargeIds->count() === 0) |
|
| 122 | + if ($chargeIds->count() === 0) |
|
| 123 | 123 | { |
| 124 | 124 | return collect(); |
| 125 | 125 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | // value can be retrieved forever, even when the membership will change. |
| 223 | 223 | $tontine = $this->tenantService->tontine(); |
| 224 | 224 | $round = $this->tenantService->round(); |
| 225 | - if($round->property === null) |
|
| 225 | + if ($round->property === null) |
|
| 226 | 226 | { |
| 227 | 227 | // Create and save the property with the content |
| 228 | 228 | $memberIds = $tontine->members()->active()->pluck('id')->all(); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | $content = $round->property->content; |
| 235 | - if(isset($content['members']) && is_array($content['members'])) |
|
| 235 | + if (isset($content['members']) && is_array($content['members'])) |
|
| 236 | 236 | { |
| 237 | 237 | // Return the existing content value |
| 238 | 238 | return count($content['members']); |
@@ -264,12 +264,12 @@ discard block |
||
| 264 | 264 | }; |
| 265 | 265 | $bills = $this->getBills($settlementFilter, $member); |
| 266 | 266 | $disbursements = $this->getDisbursedAmounts($charges->pluck('id'), $sessionIds); |
| 267 | - if($member !== null) |
|
| 267 | + if ($member !== null) |
|
| 268 | 268 | { |
| 269 | 269 | // The disbursement part of each member id calculated by dividing each amount |
| 270 | 270 | // by the number of members. |
| 271 | 271 | $memberCount = $this->countActiveMembers(); |
| 272 | - foreach($disbursements as $disbursement) |
|
| 272 | + foreach ($disbursements as $disbursement) |
|
| 273 | 273 | { |
| 274 | 274 | $disbursement->total_amount /= $memberCount; |
| 275 | 275 | } |
@@ -297,11 +297,11 @@ discard block |
||
| 297 | 297 | ->select(DB::raw("sum($principal) as principal"), DB::raw("sum($interest) as interest")) |
| 298 | 298 | ->where('loans.session_id', $session->id) |
| 299 | 299 | ->first(); |
| 300 | - if(!$loan->principal) |
|
| 300 | + if (!$loan->principal) |
|
| 301 | 301 | { |
| 302 | 302 | $loan->principal = 0; |
| 303 | 303 | } |
| 304 | - if(!$loan->interest) |
|
| 304 | + if (!$loan->interest) |
|
| 305 | 305 | { |
| 306 | 306 | $loan->interest = 0; |
| 307 | 307 | } |
@@ -323,11 +323,11 @@ discard block |
||
| 323 | 323 | ->select(DB::raw("sum($principal) as principal"), DB::raw("sum($interest) as interest")) |
| 324 | 324 | ->where('refunds.session_id', $session->id) |
| 325 | 325 | ->first(); |
| 326 | - if(!$refund->principal) |
|
| 326 | + if (!$refund->principal) |
|
| 327 | 327 | { |
| 328 | 328 | $refund->principal = 0; |
| 329 | 329 | } |
| 330 | - if(!$refund->interest) |
|
| 330 | + if (!$refund->interest) |
|
| 331 | 331 | { |
| 332 | 332 | $refund->interest = 0; |
| 333 | 333 | } |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | ->select(DB::raw("sum($principal) as principal"), DB::raw("sum($interest) as interest")) |
| 339 | 339 | ->where('partial_refunds.session_id', $session->id) |
| 340 | 340 | ->first(); |
| 341 | - if(($partialRefund->principal)) |
|
| 341 | + if (($partialRefund->principal)) |
|
| 342 | 342 | { |
| 343 | 343 | $refund->principal += $partialRefund->principal; |
| 344 | 344 | } |
| 345 | - if(($partialRefund->interest)) |
|
| 345 | + if (($partialRefund->interest)) |
|
| 346 | 346 | { |
| 347 | 347 | $refund->interest += $partialRefund->interest; |
| 348 | 348 | } |
@@ -361,11 +361,11 @@ discard block |
||
| 361 | 361 | ->select(DB::raw('sum(amount) as total_amount'), DB::raw('count(id) as total_count')) |
| 362 | 362 | ->where('session_id', $session->id) |
| 363 | 363 | ->first(); |
| 364 | - if(!$funding->total_amount) |
|
| 364 | + if (!$funding->total_amount) |
|
| 365 | 365 | { |
| 366 | 366 | $funding->total_amount = 0; |
| 367 | 367 | } |
| 368 | - if(!$funding->total_count) |
|
| 368 | + if (!$funding->total_count) |
|
| 369 | 369 | { |
| 370 | 370 | $funding->total_count = 0; |
| 371 | 371 | } |
@@ -384,11 +384,11 @@ discard block |
||
| 384 | 384 | ->select(DB::raw('sum(amount) as total_amount'), DB::raw('count(id) as total_count')) |
| 385 | 385 | ->where('session_id', $session->id) |
| 386 | 386 | ->first(); |
| 387 | - if(!$disbursement->total_amount) |
|
| 387 | + if (!$disbursement->total_amount) |
|
| 388 | 388 | { |
| 389 | 389 | $disbursement->total_amount = 0; |
| 390 | 390 | } |
| 391 | - if(!$disbursement->total_count) |
|
| 391 | + if (!$disbursement->total_count) |
|
| 392 | 392 | { |
| 393 | 393 | $disbursement->total_count = 0; |
| 394 | 394 | } |
@@ -134,10 +134,8 @@ discard block |
||
| 134 | 134 | ->orderBy('start_at', $orderAsc ? 'asc' : 'desc') |
| 135 | 135 | ->get(); |
| 136 | 136 | |
| 137 | - return $lastSession === null ? $sessions : |
|
| 138 | - $sessions->filter(function($session) use($lastSession, $withCurrent) { |
|
| 139 | - return $withCurrent ? $session->start_at <= $lastSession->start_at : |
|
| 140 | - $session->start_at < $lastSession->start_at; |
|
| 137 | + return $lastSession === null ? $sessions : $sessions->filter(function($session) use($lastSession, $withCurrent) { |
|
| 138 | + return $withCurrent ? $session->start_at <= $lastSession->start_at : $session->start_at < $lastSession->start_at; |
|
| 141 | 139 | }); |
| 142 | 140 | } |
| 143 | 141 | |
@@ -191,7 +189,7 @@ discard block |
||
| 191 | 189 | public function getPool(int $poolId, bool $with = false): ?Pool |
| 192 | 190 | { |
| 193 | 191 | $pools = $this->round->pools(); |
| 194 | - if($with) |
|
| 192 | + if ($with) |
|
| 195 | 193 | { |
| 196 | 194 | $pools->with(['subscriptions.receivables.deposit']); |
| 197 | 195 | } |
@@ -107,14 +107,14 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function createSessions(array $values): bool |
| 109 | 109 | { |
| 110 | - foreach($values as &$value) |
|
| 110 | + foreach ($values as &$value) |
|
| 111 | 111 | { |
| 112 | 112 | $value['start_at'] = $value['date'] . ' ' . $value['start'] . ':00'; |
| 113 | 113 | $value['end_at'] = $value['date'] . ' ' . $value['end'] . ':00'; |
| 114 | 114 | } |
| 115 | 115 | DB::transaction(function() use($values) { |
| 116 | 116 | $sessions = $this->tenantService->round()->sessions()->createMany($values); |
| 117 | - foreach($sessions as $session) |
|
| 117 | + foreach ($sessions as $session) |
|
| 118 | 118 | { |
| 119 | 119 | $this->disableSessionOnPools($session); |
| 120 | 120 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | // Make sure the host belongs to the same tontine |
| 139 | 139 | $hostId = intval($values['host_id']); |
| 140 | 140 | $values['host_id'] = null; |
| 141 | - if($hostId > 0) |
|
| 141 | + if ($hostId > 0) |
|
| 142 | 142 | { |
| 143 | 143 | $values['host_id'] = $this->tenantService->tontine()->members()->find($hostId)->id; |
| 144 | 144 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $session->delete(); |
| 180 | 180 | }); |
| 181 | 181 | } |
| 182 | - catch(Exception $e) |
|
| 182 | + catch (Exception $e) |
|
| 183 | 183 | { |
| 184 | 184 | throw new MessageException(trans('tontine.session.errors.delete')); |
| 185 | 185 | } |
@@ -208,13 +208,13 @@ discard block |
||
| 208 | 208 | { |
| 209 | 209 | // When the remitments are planned, don't enable or disable a session |
| 210 | 210 | // if receivables already exist on the pool. |
| 211 | - if($pool->remit_planned && |
|
| 211 | + if ($pool->remit_planned && |
|
| 212 | 212 | $pool->subscriptions()->whereHas('receivables')->count() > 0) |
| 213 | 213 | { |
| 214 | 214 | return; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - if($session->disabled($pool)) |
|
| 217 | + if ($session->disabled($pool)) |
|
| 218 | 218 | { |
| 219 | 219 | // Enable the session for the pool. |
| 220 | 220 | $pool->disabledSessions()->detach($session->id); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $query->where('session_id', $session->id); |
| 228 | 228 | }) |
| 229 | 229 | ->count(); |
| 230 | - if($receivableQuery > 0) |
|
| 230 | + if ($receivableQuery > 0) |
|
| 231 | 231 | { |
| 232 | 232 | return; |
| 233 | 233 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $year = now()->format('Y'); |
| 245 | 245 | $date = Carbon::createFromDate($year, 1, 5, 'Africa/Douala')->locale('fr'); |
| 246 | 246 | $sessions = []; |
| 247 | - for($i = 0; $i < 12; $i++) |
|
| 247 | + for ($i = 0; $i < 12; $i++) |
|
| 248 | 248 | { |
| 249 | 249 | $session = new \stdClass(); |
| 250 | 250 | $session->title = 'Séance de ' . $date->isoFormat('MMMM YYYY'); |
@@ -178,8 +178,7 @@ |
||
| 178 | 178 | $session->disabledPools()->detach(); |
| 179 | 179 | $session->delete(); |
| 180 | 180 | }); |
| 181 | - } |
|
| 182 | - catch(Exception $e) |
|
| 181 | + } catch(Exception $e) |
|
| 183 | 182 | { |
| 184 | 183 | throw new MessageException(trans('tontine.session.errors.delete')); |
| 185 | 184 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $member->libre_bills->first()->bill : null; |
| 247 | 247 | }); |
| 248 | 248 | // Check if there is a settlement target. |
| 249 | - if(!($target = $this->targetService->getTarget($charge, $session))) |
|
| 249 | + if (!($target = $this->targetService->getTarget($charge, $session))) |
|
| 250 | 250 | { |
| 251 | 251 | return $members; |
| 252 | 252 | } |
@@ -287,12 +287,12 @@ discard block |
||
| 287 | 287 | int $memberId, bool $paid, float $amount = 0): void |
| 288 | 288 | { |
| 289 | 289 | $member = $this->tenantService->tontine()->members()->find($memberId); |
| 290 | - if(!$member) |
|
| 290 | + if (!$member) |
|
| 291 | 291 | { |
| 292 | 292 | throw new MessageException(trans('tontine.member.errors.not_found')); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - if($amount !== 0) |
|
| 295 | + if ($amount !== 0) |
|
| 296 | 296 | { |
| 297 | 297 | $amount = $this->localeService->convertMoneyToInt($amount); |
| 298 | 298 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $libreBill->session()->associate($session); |
| 310 | 310 | $libreBill->bill()->associate($bill); |
| 311 | 311 | $libreBill->save(); |
| 312 | - if($paid) |
|
| 312 | + if ($paid) |
|
| 313 | 313 | { |
| 314 | 314 | $settlement = new Settlement(); |
| 315 | 315 | $settlement->bill()->associate($bill); |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function getBill(Charge $charge, Session $session, int $memberId): ?LibreBill |
| 330 | 330 | { |
| 331 | - if(!($member = $this->tenantService->tontine()->members()->find($memberId))) |
|
| 331 | + if (!($member = $this->tenantService->tontine()->members()->find($memberId))) |
|
| 332 | 332 | { |
| 333 | 333 | throw new MessageException(trans('tontine.member.errors.not_found')); |
| 334 | 334 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | */ |
| 351 | 351 | public function updateBill(Charge $charge, Session $session, int $memberId, float $amount): void |
| 352 | 352 | { |
| 353 | - if(!($libreBill = $this->getBill($charge, $session, $memberId))) |
|
| 353 | + if (!($libreBill = $this->getBill($charge, $session, $memberId))) |
|
| 354 | 354 | { |
| 355 | 355 | return; // throw new MessageException(trans('tontine.bill.errors.not_found')); |
| 356 | 356 | } |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | */ |
| 370 | 370 | public function deleteBill(Charge $charge, Session $session, int $memberId): void |
| 371 | 371 | { |
| 372 | - if(!($libreBill = $this->getBill($charge, $session, $memberId))) |
|
| 372 | + if (!($libreBill = $this->getBill($charge, $session, $memberId))) |
|
| 373 | 373 | { |
| 374 | 374 | return; // throw new MessageException(trans('tontine.bill.errors.not_found')); |
| 375 | 375 | } |
@@ -377,10 +377,10 @@ discard block |
||
| 377 | 377 | DB::transaction(function() use($libreBill, $session) { |
| 378 | 378 | $bill = $libreBill->bill; |
| 379 | 379 | $libreBill->delete(); |
| 380 | - if($bill !== null) |
|
| 380 | + if ($bill !== null) |
|
| 381 | 381 | { |
| 382 | 382 | // Delete the settlement only if it is on the same session |
| 383 | - if($bill->settlement !== null && $bill->settlement->session_id === $session->id) |
|
| 383 | + if ($bill->settlement !== null && $bill->settlement->session_id === $session->id) |
|
| 384 | 384 | { |
| 385 | 385 | $bill->settlement->delete(); |
| 386 | 386 | } |
@@ -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 | } |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | */ |
| 52 | 52 | protected function getPool() |
| 53 | 53 | { |
| 54 | - $poolId = $this->target()->method() === 'home' ? $this->target()->args()[0] : |
|
| 55 | - intval($this->bag('subscription')->get('pool.id')); |
|
| 54 | + $poolId = $this->target()->method() === 'home' ? $this->target()->args()[0] : intval($this->bag('subscription')->get('pool.id')); |
|
| 56 | 55 | $this->pool = $this->poolService->getPool($poolId); |
| 57 | 56 | } |
| 58 | 57 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public function page(int $pageNumber = 0) |
| 88 | 88 | { |
| 89 | 89 | $search = trim($this->bag('meeting')->get('fee.member.search', '')); |
| 90 | - $paid = (bool)$this->bag('meeting')->get('fee.member.paid', false); |
|
| 90 | + $paid = (bool) $this->bag('meeting')->get('fee.member.paid', false); |
|
| 91 | 91 | $filter = $this->bag('meeting')->get('fee.member.filter', null); |
| 92 | 92 | $memberCount = $this->feeService->getMemberCount($this->charge, |
| 93 | 93 | $this->session, $search, $filter); |
@@ -147,18 +147,18 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function addBill(int $memberId, bool $paid, string $amount = '') |
| 149 | 149 | { |
| 150 | - if($this->session->closed) |
|
| 150 | + if ($this->session->closed) |
|
| 151 | 151 | { |
| 152 | 152 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 153 | 153 | return $this->response; |
| 154 | 154 | } |
| 155 | 155 | $amount = str_replace(',', '.', trim($amount)); |
| 156 | - if($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false) |
|
| 156 | + if ($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false) |
|
| 157 | 157 | { |
| 158 | 158 | $this->notify->error(trans('meeting.errors.amount.invalid', ['amount' => $amount])); |
| 159 | 159 | return $this->response; |
| 160 | 160 | } |
| 161 | - $amount = $amount === '' ? 0 : (float)$amount; |
|
| 161 | + $amount = $amount === '' ? 0 : (float) $amount; |
|
| 162 | 162 | |
| 163 | 163 | $this->feeService->createBill($this->charge, $this->session, $memberId, $paid, $amount); |
| 164 | 164 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function delBill(int $memberId) |
| 177 | 177 | { |
| 178 | - if($this->session->closed) |
|
| 178 | + if ($this->session->closed) |
|
| 179 | 179 | { |
| 180 | 180 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 181 | 181 | return $this->response; |
@@ -194,13 +194,13 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function editBill(int $memberId) |
| 196 | 196 | { |
| 197 | - if($this->session->closed) |
|
| 197 | + if ($this->session->closed) |
|
| 198 | 198 | { |
| 199 | 199 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 200 | 200 | return $this->response; |
| 201 | 201 | } |
| 202 | 202 | $bill = $this->feeService->getBill($this->charge, $this->session, $memberId); |
| 203 | - if($bill === null || $bill->bill->settlement !== null) |
|
| 203 | + if ($bill === null || $bill->bill->settlement !== null) |
|
| 204 | 204 | { |
| 205 | 205 | return $this->response; |
| 206 | 206 | } |
@@ -227,21 +227,21 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function saveBill(int $memberId, string $amount) |
| 229 | 229 | { |
| 230 | - if($this->session->closed) |
|
| 230 | + if ($this->session->closed) |
|
| 231 | 231 | { |
| 232 | 232 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 233 | 233 | return $this->response; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | $amount = str_replace(',', '.', trim($amount)); |
| 237 | - if($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false) |
|
| 237 | + if ($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false) |
|
| 238 | 238 | { |
| 239 | 239 | $this->notify->error(trans('meeting.errors.amount.invalid', ['amount' => $amount])); |
| 240 | 240 | return $this->response; |
| 241 | 241 | } |
| 242 | - $amount = $amount === '' ? 0 : (float)$amount; |
|
| 242 | + $amount = $amount === '' ? 0 : (float) $amount; |
|
| 243 | 243 | |
| 244 | - if(!$amount) |
|
| 244 | + if (!$amount) |
|
| 245 | 245 | { |
| 246 | 246 | $this->feeService->deleteBill($this->charge, $this->session, $memberId); |
| 247 | 247 | return $this->page(); |