@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | protected function chargeCreated(Tontine $tontine, Charge $charge) |
| 100 | 100 | { |
| 101 | - if(!$charge->period_once) |
|
| 101 | + if (!$charge->period_once) |
|
| 102 | 102 | { |
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | $today = now(); |
| 106 | 106 | // Create a tontine bill for each member |
| 107 | - foreach($tontine->members()->get() as $member) |
|
| 107 | + foreach ($tontine->members()->get() as $member) |
|
| 108 | 108 | { |
| 109 | 109 | $this->createTontineBill($charge, $member, $today); |
| 110 | 110 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $today = now(); |
| 122 | 122 | // Create a tontine bill for each charge |
| 123 | - foreach($tontine->charges()->active()->once()->get() as $charge) |
|
| 123 | + foreach ($tontine->charges()->active()->once()->get() as $charge) |
|
| 124 | 124 | { |
| 125 | 125 | $this->createTontineBill($charge, $member, $today); |
| 126 | 126 | } |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | ])->get(); |
| 144 | 144 | $roundCharges = $tontine->charges()->active()->round()->get(); |
| 145 | 145 | // Create a round bill for each member |
| 146 | - foreach($members as $member) |
|
| 146 | + foreach ($members as $member) |
|
| 147 | 147 | { |
| 148 | - foreach($roundCharges as $charge) |
|
| 148 | + foreach ($roundCharges as $charge) |
|
| 149 | 149 | { |
| 150 | 150 | $count = $member->round_bills->filter(function($bill) use($charge) { |
| 151 | 151 | return $bill->charge_id = $charge->id; |
| 152 | 152 | })->count(); |
| 153 | - if($count === 0) |
|
| 153 | + if ($count === 0) |
|
| 154 | 154 | { |
| 155 | 155 | $this->createRoundBill($charge, $member, $round, $today); |
| 156 | 156 | } |
@@ -158,14 +158,14 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | $tontineCharges = $tontine->charges()->active()->once()->get(); |
| 160 | 160 | // Create a tontine bill for each member |
| 161 | - foreach($members as $member) |
|
| 161 | + foreach ($members as $member) |
|
| 162 | 162 | { |
| 163 | - foreach($tontineCharges as $charge) |
|
| 163 | + foreach ($tontineCharges as $charge) |
|
| 164 | 164 | { |
| 165 | 165 | $count = $member->tontine_bills->filter(function($bill) use($charge) { |
| 166 | 166 | return $bill->charge_id = $charge->id; |
| 167 | 167 | })->count(); |
| 168 | - if($count === 0) |
|
| 168 | + if ($count === 0) |
|
| 169 | 169 | { |
| 170 | 170 | $this->createTontineBill($charge, $member, $today); |
| 171 | 171 | } |
@@ -193,14 +193,14 @@ discard block |
||
| 193 | 193 | $sessionCharges = $tontine->charges()->active()->session()->get(); |
| 194 | 194 | |
| 195 | 195 | // Sync the session bills for each member and each session charge |
| 196 | - foreach($sessionCharges as $charge) |
|
| 196 | + foreach ($sessionCharges as $charge) |
|
| 197 | 197 | { |
| 198 | - foreach($members as $member) |
|
| 198 | + foreach ($members as $member) |
|
| 199 | 199 | { |
| 200 | 200 | $count = $member->session_bills->filter(function($bill) use($charge) { |
| 201 | 201 | return $bill->charge_id = $charge->id; |
| 202 | 202 | })->count(); |
| 203 | - if($count === 0) |
|
| 203 | + if ($count === 0) |
|
| 204 | 204 | { |
| 205 | 205 | $this->createSessionBill($charge, $member, $session, $today); |
| 206 | 206 | } |
@@ -209,15 +209,15 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | // Sync the receivables for each subscription on each pool |
| 211 | 211 | $pools = Pool::ofSession($session)->get(); |
| 212 | - foreach($pools as $pool) |
|
| 212 | + foreach ($pools as $pool) |
|
| 213 | 213 | { |
| 214 | - if($session->enabled($pool)) |
|
| 214 | + if ($session->enabled($pool)) |
|
| 215 | 215 | { |
| 216 | 216 | $subscriptions = $pool->subscriptions() |
| 217 | 217 | ->whereDoesntHave('receivables', function(Builder $query) use($session) { |
| 218 | 218 | return $query->where('session_id', $session->id); |
| 219 | 219 | }); |
| 220 | - foreach($subscriptions->get() as $subscription) |
|
| 220 | + foreach ($subscriptions->get() as $subscription) |
|
| 221 | 221 | { |
| 222 | 222 | $subscription->receivables()->create(['session_id' => $session->id]); |
| 223 | 223 | } |
@@ -53,25 +53,25 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function getRemitmentCount(int $sessionCount, int $subscriptionCount, int $sessionPosition): int |
| 55 | 55 | { |
| 56 | - if($sessionCount === 0 || $subscriptionCount === 0) |
|
| 56 | + if ($sessionCount === 0 || $subscriptionCount === 0) |
|
| 57 | 57 | { |
| 58 | 58 | return 0; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // Greatest common divisor |
| 62 | - $gcd = (int)gmp_gcd($sessionCount, $subscriptionCount); |
|
| 63 | - $sessionsInLoop = (int)($sessionCount / $gcd); |
|
| 62 | + $gcd = (int) gmp_gcd($sessionCount, $subscriptionCount); |
|
| 63 | + $sessionsInLoop = (int) ($sessionCount / $gcd); |
|
| 64 | 64 | $positionInLoop = $sessionPosition % $sessionsInLoop; |
| 65 | - $subscriptionsInLoop = (int)($subscriptionCount / $gcd); |
|
| 65 | + $subscriptionsInLoop = (int) ($subscriptionCount / $gcd); |
|
| 66 | 66 | $extraSubscriptionsInLoop = $subscriptionsInLoop % $sessionsInLoop; |
| 67 | 67 | |
| 68 | 68 | // There's is an extra remitment when the modulo decreases compared to the previous session. |
| 69 | 69 | $prevModulo = ($positionInLoop * $extraSubscriptionsInLoop) % $sessionsInLoop; |
| 70 | - if($prevModulo > ($prevModulo + $extraSubscriptionsInLoop) % $sessionsInLoop) |
|
| 70 | + if ($prevModulo > ($prevModulo + $extraSubscriptionsInLoop) % $sessionsInLoop) |
|
| 71 | 71 | { |
| 72 | - return (int)floor($subscriptionCount / $sessionCount) + 1; |
|
| 72 | + return (int) floor($subscriptionCount / $sessionCount) + 1; |
|
| 73 | 73 | } |
| 74 | - return (int)floor($subscriptionCount / $sessionCount); |
|
| 74 | + return (int) floor($subscriptionCount / $sessionCount); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -109,15 +109,14 @@ discard block |
||
| 109 | 109 | $position = 0; |
| 110 | 110 | $cashier = 0; |
| 111 | 111 | $expectedFigures = []; |
| 112 | - foreach($sessions as $session) |
|
| 112 | + foreach ($sessions as $session) |
|
| 113 | 113 | { |
| 114 | 114 | $figures = $this->makeFigures(0); |
| 115 | 115 | $figures->cashier->start = $cashier; |
| 116 | 116 | $figures->cashier->recv = $cashier + $depositAmount; |
| 117 | 117 | $figures->deposit->count = $depositCount; |
| 118 | 118 | $figures->deposit->amount = $depositAmount; |
| 119 | - $figures->remitment->count = !$pool->deposit_fixed ? 1 : |
|
| 120 | - $this->getRemitmentCount($sessionCount, $subscriptionCount, $position++); |
|
| 119 | + $figures->remitment->count = !$pool->deposit_fixed ? 1 : $this->getRemitmentCount($sessionCount, $subscriptionCount, $position++); |
|
| 121 | 120 | $figures->remitment->amount = $remitmentAmount * $figures->remitment->count; |
| 122 | 121 | $figures->cashier->end = $cashier + $depositAmount - $figures->remitment->amount; |
| 123 | 122 | $cashier = $figures->cashier->end; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function getReceivableAmount(Receivable $receivable): int |
| 38 | 38 | { |
| 39 | - if($receivable->subscription->pool->deposit_fixed) |
|
| 39 | + if ($receivable->subscription->pool->deposit_fixed) |
|
| 40 | 40 | { |
| 41 | 41 | return $receivable->subscription->pool->amount; |
| 42 | 42 | } |
@@ -87,8 +87,7 @@ discard block |
||
| 87 | 87 | ->where('receivables.session_id', $session->id) |
| 88 | 88 | ->where('subscriptions.pool_id', $pool->id); |
| 89 | 89 | |
| 90 | - return !$pool->deposit_fixed ? $query->sum('deposits.amount') : |
|
| 91 | - $pool->amount * $query->count(); |
|
| 90 | + return !$pool->deposit_fixed ? $query->sum('deposits.amount') : $pool->amount * $query->count(); |
|
| 92 | 91 | } |
| 93 | 92 | |
| 94 | 93 | /** |
@@ -100,7 +99,7 @@ discard block |
||
| 100 | 99 | public function getPayableAmount(Payable $payable, Session $session): int |
| 101 | 100 | { |
| 102 | 101 | $pool = $payable->subscription->pool; |
| 103 | - if($pool->deposit_fixed) |
|
| 102 | + if ($pool->deposit_fixed) |
|
| 104 | 103 | { |
| 105 | 104 | return $pool->amount * $this->poolService->getEnabledSessionCount($pool); |
| 106 | 105 | } |
@@ -124,7 +123,7 @@ discard block |
||
| 124 | 123 | */ |
| 125 | 124 | public function getPoolRemitmentAmount(Pool $pool, Session $session): int |
| 126 | 125 | { |
| 127 | - if(!$pool->deposit_fixed) |
|
| 126 | + if (!$pool->deposit_fixed) |
|
| 128 | 127 | { |
| 129 | 128 | // Sum the amounts for all deposits |
| 130 | 129 | return $this->getPoolDepositAmount($pool, $session); |
@@ -284,7 +283,7 @@ discard block |
||
| 284 | 283 | ->join('debts', 'partial_refunds.debt_id', '=', 'debts.id') |
| 285 | 284 | ->join('loans', 'debts.loan_id', '=', 'loans.id') |
| 286 | 285 | ->whereIn('partial_refunds.session_id', $sessionIds) |
| 287 | - ->whereNotExists(function (Builder $query) { |
|
| 286 | + ->whereNotExists(function(Builder $query) { |
|
| 288 | 287 | $query->select(DB::raw(1))->from('refunds') |
| 289 | 288 | ->whereColumn('refunds.debt_id', 'debts.id'); |
| 290 | 289 | }) |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function createSessions(array $values): bool |
| 65 | 65 | { |
| 66 | - foreach($values as &$value) |
|
| 66 | + foreach ($values as &$value) |
|
| 67 | 67 | { |
| 68 | 68 | $value['start_at'] = $value['date'] . ' ' . $value['start'] . ':00'; |
| 69 | 69 | $value['end_at'] = $value['date'] . ' ' . $value['end'] . ':00'; |
| 70 | 70 | } |
| 71 | 71 | DB::transaction(function() use($values) { |
| 72 | 72 | $sessions = $this->tenantService->round()->sessions()->createMany($values); |
| 73 | - foreach($sessions as $session) |
|
| 73 | + foreach ($sessions as $session) |
|
| 74 | 74 | { |
| 75 | 75 | $this->disableSessionOnPools($session); |
| 76 | 76 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | // Make sure the host belongs to the same tontine |
| 95 | 95 | $hostId = intval($values['host_id']); |
| 96 | 96 | $values['host_id'] = null; |
| 97 | - if($hostId > 0) |
|
| 97 | + if ($hostId > 0) |
|
| 98 | 98 | { |
| 99 | 99 | $values['host_id'] = $this->tenantService->tontine()->members()->find($hostId)->id; |
| 100 | 100 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $session->delete(); |
| 136 | 136 | }); |
| 137 | 137 | } |
| 138 | - catch(Exception $e) |
|
| 138 | + catch (Exception $e) |
|
| 139 | 139 | { |
| 140 | 140 | throw new MessageException(trans('tontine.session.errors.delete')); |
| 141 | 141 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $year = now()->format('Y'); |
| 150 | 150 | $date = Carbon::createFromDate($year, 1, 5, 'Africa/Douala')->locale('fr'); |
| 151 | 151 | $sessions = []; |
| 152 | - for($i = 0; $i < 12; $i++) |
|
| 152 | + for ($i = 0; $i < 12; $i++) |
|
| 153 | 153 | { |
| 154 | 154 | $session = new \stdClass(); |
| 155 | 155 | $session->title = 'Séance de ' . $date->isoFormat('MMMM YYYY'); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | ->withCount('receivables') |
| 156 | 156 | ->get() |
| 157 | 157 | ->sortBy('receivables_count'); |
| 158 | - if($subscriptions->count() === 0) |
|
| 158 | + if ($subscriptions->count() === 0) |
|
| 159 | 159 | { |
| 160 | 160 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
| 161 | 161 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | public function unsetPayableSession(Subscription $subscription) |
| 206 | 206 | { |
| 207 | - if(($subscription->payable->session_id)) |
|
| 207 | + if (($subscription->payable->session_id)) |
|
| 208 | 208 | { |
| 209 | 209 | $subscription->payable->session()->dissociate(); |
| 210 | 210 | $subscription->payable->save(); |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | $session = $pool->sessions()->find($sessionId); |
| 228 | 228 | $currSubscription = null; |
| 229 | 229 | $nextSubscription = null; |
| 230 | - if($currSubscriptionId > 0) |
|
| 230 | + if ($currSubscriptionId > 0) |
|
| 231 | 231 | { |
| 232 | 232 | $currSubscription = $pool->subscriptions()->with('payable')->find($currSubscriptionId); |
| 233 | - if(($currSubscription !== null && $currSubscription->payable !== null && |
|
| 233 | + if (($currSubscription !== null && $currSubscription->payable !== null && |
|
| 234 | 234 | $currSubscription->payable->remitment !== null) || $session->closed) |
| 235 | 235 | { |
| 236 | 236 | // Can't chage the beneficiary if the session is closed or if |
@@ -238,19 +238,19 @@ discard block |
||
| 238 | 238 | return false; |
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | - if($nextSubscriptionId > 0) |
|
| 241 | + if ($nextSubscriptionId > 0) |
|
| 242 | 242 | { |
| 243 | 243 | $nextSubscription = $pool->subscriptions()->with('payable')->find($nextSubscriptionId); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | DB::transaction(function() use($session, $currSubscription, $nextSubscription) { |
| 247 | 247 | // If the beneficiary already has a session assigned, first remove it. |
| 248 | - if($currSubscription !== null) |
|
| 248 | + if ($currSubscription !== null) |
|
| 249 | 249 | { |
| 250 | 250 | $this->unsetPayableSession($currSubscription); |
| 251 | 251 | } |
| 252 | 252 | // If there is a new session assigned to the beneficiary, then save it. |
| 253 | - if($nextSubscription !== null) |
|
| 253 | + if ($nextSubscription !== null) |
|
| 254 | 254 | { |
| 255 | 255 | $this->setPayableSession($nextSubscription, $session); |
| 256 | 256 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $pool->delete(); |
| 122 | 122 | }); |
| 123 | 123 | } |
| 124 | - catch(Exception $e) |
|
| 124 | + catch (Exception $e) |
|
| 125 | 125 | { |
| 126 | 126 | throw new MessageException(trans('tontine.errors.action') . |
| 127 | 127 | '<br/>' . trans('tontine.pool.errors.subscription')); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | // return; |
| 212 | 212 | // } |
| 213 | 213 | $session = $pool->sessions()->find($sessionId); |
| 214 | - if(!$session || $session->enabled($pool)) |
|
| 214 | + if (!$session || $session->enabled($pool)) |
|
| 215 | 215 | { |
| 216 | 216 | return; |
| 217 | 217 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | // return; |
| 239 | 239 | // } |
| 240 | 240 | $session = $pool->sessions()->find($sessionId); |
| 241 | - if(!$session || $session->disabled($pool)) |
|
| 241 | + if (!$session || $session->disabled($pool)) |
|
| 242 | 242 | { |
| 243 | 243 | return; |
| 244 | 244 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $lastSessionDate = $currentSession->start_at->format('Y-m-d'); |
| 39 | 39 | // The closing sessions ids |
| 40 | 40 | $closingSessionIds = array_keys($this->savingService->getFundClosings($fundId)); |
| 41 | - if(count($closingSessionIds) === 0) |
|
| 41 | + if (count($closingSessionIds) === 0) |
|
| 42 | 42 | { |
| 43 | 43 | // No closing session yet |
| 44 | 44 | return $this->tenantService->tontine()->sessions() |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | ->whereDate('sessions.start_at', '<', $lastSessionDate) |
| 52 | 52 | ->orderByDesc('sessions.start_at') |
| 53 | 53 | ->get(); |
| 54 | - if($closingSessions->count() === 0) |
|
| 54 | + if ($closingSessions->count() === 0) |
|
| 55 | 55 | { |
| 56 | 56 | // All the closing sessions are after the current session. |
| 57 | 57 | return $this->tenantService->tontine()->sessions() |
@@ -94,31 +94,31 @@ discard block |
||
| 94 | 94 | int $profitAmount): Collection |
| 95 | 95 | { |
| 96 | 96 | // Set savings durations and distributions |
| 97 | - foreach($savings as $saving) |
|
| 97 | + foreach ($savings as $saving) |
|
| 98 | 98 | { |
| 99 | 99 | $saving->duration = $this->getSavingDuration($sessions, $saving); |
| 100 | 100 | $saving->distribution = $saving->amount * $saving->duration; |
| 101 | 101 | $saving->profit = 0; |
| 102 | 102 | } |
| 103 | 103 | // Reduce the distributions |
| 104 | - $distributionGcd = (int)$savings->reduce(function($gcd, $saving) { |
|
| 105 | - if($gcd === 0) |
|
| 104 | + $distributionGcd = (int) $savings->reduce(function($gcd, $saving) { |
|
| 105 | + if ($gcd === 0) |
|
| 106 | 106 | { |
| 107 | 107 | return $saving->distribution; |
| 108 | 108 | } |
| 109 | - if($saving->duration === 0) |
|
| 109 | + if ($saving->duration === 0) |
|
| 110 | 110 | { |
| 111 | 111 | return $gcd; |
| 112 | 112 | } |
| 113 | 113 | return gmp_gcd($gcd, $saving->distribution); |
| 114 | 114 | }, $savings->first()->distribution); |
| 115 | - if($distributionGcd > 0) |
|
| 115 | + if ($distributionGcd > 0) |
|
| 116 | 116 | { |
| 117 | - $sum = (int)($savings->sum('distribution') / $distributionGcd); |
|
| 118 | - foreach($savings as $saving) |
|
| 117 | + $sum = (int) ($savings->sum('distribution') / $distributionGcd); |
|
| 118 | + foreach ($savings as $saving) |
|
| 119 | 119 | { |
| 120 | 120 | $saving->distribution /= $distributionGcd; |
| 121 | - $saving->profit = (int)($profitAmount * $saving->distribution / $sum); |
|
| 121 | + $saving->profit = (int) ($profitAmount * $saving->distribution / $sum); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
@@ -146,9 +146,8 @@ discard block |
||
| 146 | 146 | ->orderBy('sessions.start_at', 'asc') |
| 147 | 147 | ->with(['session', 'member']); |
| 148 | 148 | $savings = $fundId > 0 ? |
| 149 | - $query->where('savings.fund_id', $fundId)->get() : |
|
| 150 | - $query->whereNull('savings.fund_id')->get(); |
|
| 151 | - if($savings->count() === 0) |
|
| 149 | + $query->where('savings.fund_id', $fundId)->get() : $query->whereNull('savings.fund_id')->get(); |
|
| 150 | + if ($savings->count() === 0) |
|
| 152 | 151 | { |
| 153 | 152 | return $savings; |
| 154 | 153 | } |
@@ -168,13 +167,13 @@ discard block |
||
| 168 | 167 | // The part value makes sense only iwhen there is more than 2 savings |
| 169 | 168 | // with distribution greater than 0. |
| 170 | 169 | $savings = $savings->filter(fn($saving) => $saving->distribution > 0); |
| 171 | - if($savings->count() < 2) |
|
| 170 | + if ($savings->count() < 2) |
|
| 172 | 171 | { |
| 173 | 172 | return 0; |
| 174 | 173 | } |
| 175 | 174 | |
| 176 | 175 | $saving = $savings->first(); |
| 177 | - return (int)($saving->amount * $saving->duration / $saving->distribution); |
|
| 176 | + return (int) ($saving->amount * $saving->duration / $saving->distribution); |
|
| 178 | 177 | } |
| 179 | 178 | |
| 180 | 179 | /** |
@@ -201,8 +200,7 @@ discard block |
||
| 201 | 200 | ->select(DB::raw("sum(amount) as total")) |
| 202 | 201 | ->whereIn('session_id', $sessionIds); |
| 203 | 202 | $saving = $fundId > 0 ? |
| 204 | - $query->where('savings.fund_id', $fundId)->first() : |
|
| 205 | - $query->whereNull('savings.fund_id')->first(); |
|
| 203 | + $query->where('savings.fund_id', $fundId)->first() : $query->whereNull('savings.fund_id')->first(); |
|
| 206 | 204 | return $saving->total ?? 0; |
| 207 | 205 | } |
| 208 | 206 | |
@@ -223,8 +221,7 @@ discard block |
||
| 223 | 221 | ->where('debts.type', Debt::TYPE_INTEREST) |
| 224 | 222 | ->whereIn('refunds.session_id', $sessionIds); |
| 225 | 223 | $refund = $fundId > 0 ? |
| 226 | - $query->where('loans.fund_id', $fundId)->first() : |
|
| 227 | - $query->whereNull('loans.fund_id')->first(); |
|
| 224 | + $query->where('loans.fund_id', $fundId)->first() : $query->whereNull('loans.fund_id')->first(); |
|
| 228 | 225 | return $refund->total ?? 0; |
| 229 | 226 | } |
| 230 | 227 | |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | $saving->amount = $values['amount']; |
| 79 | 79 | $saving->member()->associate($member); |
| 80 | 80 | $saving->session()->associate($session); |
| 81 | - if($values['fund_id'] !== 0) |
|
| 81 | + if ($values['fund_id'] !== 0) |
|
| 82 | 82 | { |
| 83 | 83 | $fund = $this->fundService->getFund($values['fund_id']); |
| 84 | - if($fund !== null) |
|
| 84 | + if ($fund !== null) |
|
| 85 | 85 | { |
| 86 | 86 | $saving->fund()->associate($fund); |
| 87 | 87 | } |
@@ -101,17 +101,17 @@ discard block |
||
| 101 | 101 | public function updateSaving(Member $member, Session $session, int $savingId, array $values): void |
| 102 | 102 | { |
| 103 | 103 | $saving = $session->savings()->find($savingId); |
| 104 | - if(!$saving) |
|
| 104 | + if (!$saving) |
|
| 105 | 105 | { |
| 106 | 106 | throw new MessageException(trans('meeting.saving.errors.not_found')); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | $saving->amount = $values['amount']; |
| 110 | 110 | $saving->member()->associate($member); |
| 111 | - if($values['fund_id'] !== 0) |
|
| 111 | + if ($values['fund_id'] !== 0) |
|
| 112 | 112 | { |
| 113 | 113 | $fund = $this->fundService->getFund($values['fund_id']); |
| 114 | - if($fund !== null) |
|
| 114 | + if ($fund !== null) |
|
| 115 | 115 | { |
| 116 | 116 | $saving->fund()->associate($fund); |
| 117 | 117 | } |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | { |
| 194 | 194 | $tontine = $this->tenantService->tontine(); |
| 195 | 195 | $properties = $tontine->properties; |
| 196 | - if(isset($properties['closings'][$session->id][$fundId])) |
|
| 196 | + if (isset($properties['closings'][$session->id][$fundId])) |
|
| 197 | 197 | { |
| 198 | 198 | unset($properties['closings'][$session->id][$fundId]); |
| 199 | - if(count($properties['closings'][$session->id]) == 0) |
|
| 199 | + if (count($properties['closings'][$session->id]) == 0) |
|
| 200 | 200 | { |
| 201 | 201 | unset($properties['closings'][$session->id]); |
| 202 | 202 | } |
@@ -115,8 +115,7 @@ |
||
| 115 | 115 | { |
| 116 | 116 | $saving->fund()->associate($fund); |
| 117 | 117 | } |
| 118 | - } |
|
| 119 | - else |
|
| 118 | + } else |
|
| 120 | 119 | { |
| 121 | 120 | $saving->fund()->dissociate(); |
| 122 | 121 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function checkPoolsSubscriptions() |
| 33 | 33 | { |
| 34 | - if($this->tenantService->round()->pools()->whereDoesntHave('subscriptions')->count() > 0) |
|
| 34 | + if ($this->tenantService->round()->pools()->whereDoesntHave('subscriptions')->count() > 0) |
|
| 35 | 35 | { |
| 36 | 36 | throw new MessageException(trans('tontine.errors.action') . |
| 37 | 37 | '<br/>' . trans('tontine.pool.errors.no_subscription')); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function openSession(Session $session) |
| 79 | 79 | { |
| 80 | - if($session->opened) |
|
| 80 | + if ($session->opened) |
|
| 81 | 81 | { |
| 82 | 82 | return; |
| 83 | 83 | } |
@@ -159,6 +159,6 @@ discard block |
||
| 159 | 159 | Session::STATUS_PENDING => trans('tontine.session.status.pending'), |
| 160 | 160 | Session::STATUS_OPENED => trans('tontine.session.status.opened'), |
| 161 | 161 | Session::STATUS_CLOSED => trans('tontine.session.status.closed'), |
| 162 | - ];; |
|
| 162 | + ]; ; |
|
| 163 | 163 | } |
| 164 | 164 | } |