@@ -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); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $this->localeService->setCurrency($tontine->currency_code); |
| 67 | 67 | // Save as latest tontine id if it has changed. |
| 68 | 68 | $tontineId = $this->user->properties['latest']['tontine'] ?? 0; |
| 69 | - if($tontineId === $tontine->id) |
|
| 69 | + if ($tontineId === $tontine->id) |
|
| 70 | 70 | { |
| 71 | 71 | return; |
| 72 | 72 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $this->round = $round; |
| 86 | 86 | // Save as latest round id if it has changed. |
| 87 | 87 | $roundId = $this->user->properties['latest']['round'] ?? 0; |
| 88 | - if($roundId === $round->id) |
|
| 88 | + if ($roundId === $round->id) |
|
| 89 | 89 | { |
| 90 | 90 | return; |
| 91 | 91 | } |
@@ -152,10 +152,8 @@ discard block |
||
| 152 | 152 | ->orderBy('start_at', $orderAsc ? 'asc' : 'desc') |
| 153 | 153 | ->get(); |
| 154 | 154 | |
| 155 | - return $lastSession === null ? $sessions : |
|
| 156 | - $sessions->filter(function($session) use($lastSession, $withCurrent) { |
|
| 157 | - return $withCurrent ? $session->start_at <= $lastSession->start_at : |
|
| 158 | - $session->start_at < $lastSession->start_at; |
|
| 155 | + return $lastSession === null ? $sessions : $sessions->filter(function($session) use($lastSession, $withCurrent) { |
|
| 156 | + return $withCurrent ? $session->start_at <= $lastSession->start_at : $session->start_at < $lastSession->start_at; |
|
| 159 | 157 | }); |
| 160 | 158 | } |
| 161 | 159 | |
@@ -209,7 +207,7 @@ discard block |
||
| 209 | 207 | public function getPool(int $poolId, bool $with = false): ?Pool |
| 210 | 208 | { |
| 211 | 209 | $pools = $this->round->pools(); |
| 212 | - if($with) |
|
| 210 | + if ($with) |
|
| 213 | 211 | { |
| 214 | 212 | $pools->with(['subscriptions.receivables.deposit']); |
| 215 | 213 | } |
@@ -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 | } |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | ->each(function($payable) use($session) { |
| 120 | 120 | $payable->amount = $this->balanceCalculator->getPayableAmount($payable, $session); |
| 121 | 121 | }); |
| 122 | - if(!$pool->remit_planned) |
|
| 122 | + if (!$pool->remit_planned) |
|
| 123 | 123 | { |
| 124 | 124 | return $payables; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // When the number of remitments is planned, the list is padded to the expected number. |
| 128 | 128 | $remitmentCount = $this->summaryService->getSessionRemitmentCount($pool, $session); |
| 129 | - $emptyPayable = (object)[ |
|
| 129 | + $emptyPayable = (object) [ |
|
| 130 | 130 | 'id' => 0, |
| 131 | 131 | 'amount' => $pool->amount * $this->tenantService->countEnabledSessions($pool), |
| 132 | 132 | 'remitment' => null, |
@@ -161,18 +161,18 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function savePlannedRemitment(Pool $pool, Session $session, int $payableId): void |
| 163 | 163 | { |
| 164 | - if(!$pool->remit_planned || $pool->remit_auction) |
|
| 164 | + if (!$pool->remit_planned || $pool->remit_auction) |
|
| 165 | 165 | { |
| 166 | 166 | // Only when remitments are planned and without auctions. |
| 167 | 167 | return; |
| 168 | 168 | } |
| 169 | 169 | // The payable is supposed to already have been associated to the session. |
| 170 | 170 | $payable = $this->getPayable($pool, $session, $payableId); |
| 171 | - if(!$payable) |
|
| 171 | + if (!$payable) |
|
| 172 | 172 | { |
| 173 | 173 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
| 174 | 174 | } |
| 175 | - if($payable->remitment) |
|
| 175 | + if ($payable->remitment) |
|
| 176 | 176 | { |
| 177 | 177 | return; |
| 178 | 178 | } |
@@ -199,11 +199,11 @@ discard block |
||
| 199 | 199 | ->whereDoesntHave('remitment') |
| 200 | 200 | ->whereIn('subscription_id', $pool->subscriptions()->pluck('id')) |
| 201 | 201 | ->find($payableId); |
| 202 | - if(!$payable) |
|
| 202 | + if (!$payable) |
|
| 203 | 203 | { |
| 204 | 204 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
| 205 | 205 | } |
| 206 | - if($payable->session_id !== null && $payable->session_id !== $session->id) |
|
| 206 | + if ($payable->session_id !== null && $payable->session_id !== $session->id) |
|
| 207 | 207 | { |
| 208 | 208 | // The selected member is already planned on another session. |
| 209 | 209 | throw new MessageException(trans('tontine.remitment.errors.planning')); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | // Create the remitment. |
| 217 | 217 | $remitment = $payable->remitment()->create(['amount' => $amount]); |
| 218 | 218 | |
| 219 | - if($pool->remit_auction && $auction > 0) |
|
| 219 | + if ($pool->remit_auction && $auction > 0) |
|
| 220 | 220 | { |
| 221 | 221 | // Create the corresponding auction. |
| 222 | 222 | Auction::create([ |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $payable = $this->getQuery($pool, $session) |
| 244 | 244 | ->with(['remitment', 'remitment.auction']) |
| 245 | 245 | ->find($payableId); |
| 246 | - if(!$payable || !($remitment = $payable->remitment)) |
|
| 246 | + if (!$payable || !($remitment = $payable->remitment)) |
|
| 247 | 247 | { |
| 248 | 248 | return; |
| 249 | 249 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $remitment->auction()->delete(); |
| 254 | 254 | $remitment->delete(); |
| 255 | 255 | // Detach from the session, but only if the remitment was not planned. |
| 256 | - if(!$pool->remit_planned || $pool->remit_auction) |
|
| 256 | + if (!$pool->remit_planned || $pool->remit_auction) |
|
| 257 | 257 | { |
| 258 | 258 | $payable->session()->dissociate(); |
| 259 | 259 | $payable->save(); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | ->with(['payable', 'member']) |
| 279 | 279 | ->select('subscriptions.*') |
| 280 | 280 | ->get(); |
| 281 | - if($pool->remit_planned && !$pool->remit_auction) |
|
| 281 | + if ($pool->remit_planned && !$pool->remit_auction) |
|
| 282 | 282 | { |
| 283 | 283 | // Only the beneficiaries planned for this session. |
| 284 | 284 | return $subscriptions |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $session = $this->tenantService->getSession($sessionId); |
| 48 | 48 | $html = view('tontine.report.session', $this->reportService->getSessionReport($session)); |
| 49 | 49 | // Show the html page |
| 50 | - if($request->has('html')) |
|
| 50 | + if ($request->has('html')) |
|
| 51 | 51 | { |
| 52 | 52 | return $html; |
| 53 | 53 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $round = $this->tenantService->getRound($roundId); |
| 89 | 89 | $html = view('tontine.report.round', $this->reportService->getRoundReport($round)); |
| 90 | 90 | // Show the html page |
| 91 | - if($request->has('html')) |
|
| 91 | + if ($request->has('html')) |
|
| 92 | 92 | { |
| 93 | 93 | return $html; |
| 94 | 94 | } |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | return $session->opened || $session->closed; |
| 35 | 35 | }) |
| 36 | 36 | ->pluck('title', 'id'); |
| 37 | - if($sessions->count() === 0) |
|
| 37 | + if ($sessions->count() === 0) |
|
| 38 | 38 | { |
| 39 | 39 | return $this->response; |
| 40 | 40 | } |
| 41 | 41 | $members = $this->tontineService->getMembers(); |
| 42 | - if($members->count() === 0) |
|
| 42 | + if ($members->count() === 0) |
|
| 43 | 43 | { |
| 44 | 44 | return $this->response; |
| 45 | 45 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function showSession(int $sessionId) |
| 67 | 67 | { |
| 68 | - if(!($session = $this->tenantService->getSession($sessionId))) |
|
| 68 | + if (!($session = $this->tenantService->getSession($sessionId))) |
|
| 69 | 69 | { |
| 70 | 70 | return $this->response; |
| 71 | 71 | } |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function showMember(int $sessionId, int $memberId) |
| 80 | 80 | { |
| 81 | - if(!($session = $this->tenantService->getSession($sessionId))) |
|
| 81 | + if (!($session = $this->tenantService->getSession($sessionId))) |
|
| 82 | 82 | { |
| 83 | 83 | return $this->response; |
| 84 | 84 | } |
| 85 | - if(!($member = $this->tontineService->getMember($memberId))) |
|
| 85 | + if (!($member = $this->tontineService->getMember($memberId))) |
|
| 86 | 86 | { |
| 87 | 87 | return $this->response; |
| 88 | 88 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | ->withCount('receivables') |
| 161 | 161 | ->get() |
| 162 | 162 | ->sortBy('receivables_count'); |
| 163 | - if($subscriptions->count() === 0) |
|
| 163 | + if ($subscriptions->count() === 0) |
|
| 164 | 164 | { |
| 165 | 165 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
| 166 | 166 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function unsetPayableSession(Subscription $subscription) |
| 211 | 211 | { |
| 212 | - if(($subscription->payable->session_id)) |
|
| 212 | + if (($subscription->payable->session_id)) |
|
| 213 | 213 | { |
| 214 | 214 | $subscription->payable->session()->dissociate(); |
| 215 | 215 | $subscription->payable->save(); |
@@ -231,10 +231,10 @@ discard block |
||
| 231 | 231 | { |
| 232 | 232 | $session = $this->tenantService->getSession($sessionId); |
| 233 | 233 | $currSubscription = null; |
| 234 | - if($currSubscriptionId > 0) |
|
| 234 | + if ($currSubscriptionId > 0) |
|
| 235 | 235 | { |
| 236 | 236 | $currSubscription = $pool->subscriptions()->find($currSubscriptionId); |
| 237 | - if(($currSubscription !== null && $currSubscription->payable !== null && |
|
| 237 | + if (($currSubscription !== null && $currSubscription->payable !== null && |
|
| 238 | 238 | $currSubscription->payable->remitment !== null) || $session->closed) |
| 239 | 239 | { |
| 240 | 240 | // Can't chage the beneficiary if the session is closed or if |
@@ -247,12 +247,12 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | DB::transaction(function() use($session, $currSubscription, $nextSubscription) { |
| 249 | 249 | // If the beneficiary already has a session assigned, first remove it. |
| 250 | - if($currSubscription !== null) |
|
| 250 | + if ($currSubscription !== null) |
|
| 251 | 251 | { |
| 252 | 252 | $this->unsetPayableSession($currSubscription); |
| 253 | 253 | } |
| 254 | 254 | // If there is a new session assigned to the beneficiary, then save it. |
| 255 | - if($nextSubscription !== null) |
|
| 255 | + if ($nextSubscription !== null) |
|
| 256 | 256 | { |
| 257 | 257 | $this->setPayableSession($nextSubscription, $session); |
| 258 | 258 | } |
@@ -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 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | // The closing sessions ids |
| 46 | 46 | $properties = $this->tenantService->tontine()->properties; |
| 47 | 47 | $closingSessionIds = array_keys($properties['profit'][$fundId] ?? []); |
| 48 | - if(count($closingSessionIds) === 0) |
|
| 48 | + if (count($closingSessionIds) === 0) |
|
| 49 | 49 | { |
| 50 | 50 | // No closing session yet |
| 51 | 51 | return $sessions; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | // The previous closing sessions |
| 54 | 54 | $closingSessions = $sessions->filter(fn($session) => |
| 55 | 55 | $session->id !== $currentSession->id && in_array($session->id, $closingSessionIds)); |
| 56 | - if($closingSessions->count() === 0) |
|
| 56 | + if ($closingSessions->count() === 0) |
|
| 57 | 57 | { |
| 58 | 58 | // All the closing sessions are after the current session. |
| 59 | 59 | return $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 | |