@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function handle(NewFeedback $event) |
19 | 19 | { |
20 | - if(!($mailTo = env('MAIL_FEEDBACK_TO'))) |
|
20 | + if (!($mailTo = env('MAIL_FEEDBACK_TO'))) |
|
21 | 21 | { |
22 | 22 | return; |
23 | 23 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function getReceivableAmount(Receivable $receivable): int |
37 | 37 | { |
38 | - if($receivable->subscription->pool->deposit_fixed) |
|
38 | + if ($receivable->subscription->pool->deposit_fixed) |
|
39 | 39 | { |
40 | 40 | return $receivable->subscription->pool->amount; |
41 | 41 | } |
@@ -86,8 +86,7 @@ discard block |
||
86 | 86 | ->where('receivables.session_id', $session->id) |
87 | 87 | ->where('subscriptions.pool_id', $pool->id); |
88 | 88 | |
89 | - return !$pool->deposit_fixed ? $query->sum('deposits.amount') : |
|
90 | - $pool->amount * $query->count(); |
|
89 | + return !$pool->deposit_fixed ? $query->sum('deposits.amount') : $pool->amount * $query->count(); |
|
91 | 90 | } |
92 | 91 | |
93 | 92 | /** |
@@ -98,7 +97,7 @@ discard block |
||
98 | 97 | */ |
99 | 98 | public function getPayableAmount(Pool $pool, Session $session): int |
100 | 99 | { |
101 | - if(!$pool->deposit_fixed) |
|
100 | + if (!$pool->deposit_fixed) |
|
102 | 101 | { |
103 | 102 | // Sum the amounts for all deposits |
104 | 103 | return $this->getPoolDepositAmount($pool, $session); |
@@ -122,7 +121,7 @@ discard block |
||
122 | 121 | */ |
123 | 122 | public function getPoolRemitmentAmount(Pool $pool, Session $session): int |
124 | 123 | { |
125 | - if(!$pool->deposit_fixed) |
|
124 | + if (!$pool->deposit_fixed) |
|
126 | 125 | { |
127 | 126 | // Sum the amounts for all deposits |
128 | 127 | return $this->getPoolDepositAmount($pool, $session); |
@@ -282,7 +281,7 @@ discard block |
||
282 | 281 | ->join('debts', 'partial_refunds.debt_id', '=', 'debts.id') |
283 | 282 | ->join('loans', 'debts.loan_id', '=', 'loans.id') |
284 | 283 | ->whereIn('partial_refunds.session_id', $sessionIds) |
285 | - ->whereNotExists(function (Builder $query) { |
|
284 | + ->whereNotExists(function(Builder $query) { |
|
286 | 285 | $query->select(DB::raw(1))->from('refunds') |
287 | 286 | ->whereColumn('refunds.debt_id', 'debts.id'); |
288 | 287 | }) |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return Builder|Relation |
50 | 50 | */ |
51 | - public function getQuery(Pool $pool, string $search, ?bool $filter): Builder|Relation |
|
51 | + public function getQuery(Pool $pool, string $search, ?bool $filter): Builder | Relation |
|
52 | 52 | { |
53 | 53 | return $this->tenantService->tontine()->members()->active() |
54 | 54 | ->when($filter === true, function(Builder $query) use($pool) { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | ->withCount('receivables') |
157 | 157 | ->get() |
158 | 158 | ->sortBy('receivables_count'); |
159 | - if($subscriptions->count() === 0) |
|
159 | + if ($subscriptions->count() === 0) |
|
160 | 160 | { |
161 | 161 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
162 | 162 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function unsetPayableSession(Subscription $subscription) |
207 | 207 | { |
208 | - if(($subscription->payable->session_id)) |
|
208 | + if (($subscription->payable->session_id)) |
|
209 | 209 | { |
210 | 210 | $subscription->payable->session()->dissociate(); |
211 | 211 | $subscription->payable->save(); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | private function canChangeBeneficiary(Session $session, ?Subscription $subscription): bool |
222 | 222 | { |
223 | 223 | // Can't change the beneficiary if the session is closed, |
224 | - if($session->closed) |
|
224 | + if ($session->closed) |
|
225 | 225 | { |
226 | 226 | return false; |
227 | 227 | } |
@@ -246,17 +246,17 @@ discard block |
||
246 | 246 | $session = $pool->sessions()->find($sessionId); |
247 | 247 | $currSubscription = null; |
248 | 248 | $nextSubscription = null; |
249 | - if($currSubscriptionId > 0) |
|
249 | + if ($currSubscriptionId > 0) |
|
250 | 250 | { |
251 | 251 | $currSubscription = $pool->subscriptions() |
252 | 252 | ->with('payable') |
253 | 253 | ->find($currSubscriptionId); |
254 | - if(!$this->canChangeBeneficiary($session, $currSubscription)) |
|
254 | + if (!$this->canChangeBeneficiary($session, $currSubscription)) |
|
255 | 255 | { |
256 | 256 | return false; |
257 | 257 | } |
258 | 258 | } |
259 | - if($nextSubscriptionId > 0) |
|
259 | + if ($nextSubscriptionId > 0) |
|
260 | 260 | { |
261 | 261 | $nextSubscription = $pool->subscriptions() |
262 | 262 | ->with('payable') |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | |
266 | 266 | DB::transaction(function() use($session, $currSubscription, $nextSubscription) { |
267 | 267 | // If the beneficiary already has a session assigned, first remove it. |
268 | - if($currSubscription !== null) |
|
268 | + if ($currSubscription !== null) |
|
269 | 269 | { |
270 | 270 | $this->unsetPayableSession($currSubscription); |
271 | 271 | } |
272 | 272 | // If there is a new session assigned to the beneficiary, then save it. |
273 | - if($nextSubscription !== null) |
|
273 | + if ($nextSubscription !== null) |
|
274 | 274 | { |
275 | 275 | $this->setPayableSession($nextSubscription, $session); |
276 | 276 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @return Builder|Relation |
41 | 41 | */ |
42 | - private function getQuery(Pool $pool, Session $session): Builder|Relation |
|
42 | + private function getQuery(Pool $pool, Session $session): Builder | Relation |
|
43 | 43 | { |
44 | 44 | return $session->payables() |
45 | 45 | ->select('payables.*') |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | ->each(function($payable) use($amount) { |
80 | 80 | $payable->amount = $amount; |
81 | 81 | }); |
82 | - if(!$pool->remit_planned) |
|
82 | + if (!$pool->remit_planned) |
|
83 | 83 | { |
84 | 84 | return $payables; |
85 | 85 | } |
86 | 86 | |
87 | 87 | // When the number of remitments is planned, the list is padded to the expected number. |
88 | 88 | $remitmentCount = $this->summaryService->getSessionRemitmentCount($pool, $session); |
89 | - $emptyPayable = (object)[ |
|
89 | + $emptyPayable = (object) [ |
|
90 | 90 | 'id' => 0, |
91 | 91 | 'member' =>trans('tontine.remitment.labels.not-assigned'), |
92 | 92 | 'amount' => $amount, |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function savePlannedRemitment(Pool $pool, Session $session, int $payableId): void |
124 | 124 | { |
125 | - if(!$pool->remit_planned || $pool->remit_auction) |
|
125 | + if (!$pool->remit_planned || $pool->remit_auction) |
|
126 | 126 | { |
127 | 127 | // Only when remitments are planned and without auctions. |
128 | 128 | return; |
129 | 129 | } |
130 | 130 | // The payable is supposed to already have been associated to the session. |
131 | 131 | $payable = $this->getPayable($pool, $session, $payableId); |
132 | - if(!$payable) |
|
132 | + if (!$payable) |
|
133 | 133 | { |
134 | 134 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
135 | 135 | } |
136 | - if($payable->remitment) |
|
136 | + if ($payable->remitment) |
|
137 | 137 | { |
138 | 138 | return; |
139 | 139 | } |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | ->whereDoesntHave('remitment') |
159 | 159 | ->whereIn('subscription_id', $pool->subscriptions()->pluck('id')) |
160 | 160 | ->find($payableId); |
161 | - if(!$payable) |
|
161 | + if (!$payable) |
|
162 | 162 | { |
163 | 163 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
164 | 164 | } |
165 | - if($payable->session_id !== null && $payable->session_id !== $session->id) |
|
165 | + if ($payable->session_id !== null && $payable->session_id !== $session->id) |
|
166 | 166 | { |
167 | 167 | // The selected member is already planned on another session. |
168 | 168 | throw new MessageException(trans('tontine.remitment.errors.planning')); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | // Create the remitment. |
176 | 176 | $remitment = $payable->remitment()->create([]); |
177 | 177 | |
178 | - if($pool->remit_auction && $auction > 0) |
|
178 | + if ($pool->remit_auction && $auction > 0) |
|
179 | 179 | { |
180 | 180 | // Create the corresponding auction. |
181 | 181 | Auction::create([ |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $payable = $this->getQuery($pool, $session) |
203 | 203 | ->with(['remitment', 'remitment.auction']) |
204 | 204 | ->find($payableId); |
205 | - if(!$payable || !($remitment = $payable->remitment)) |
|
205 | + if (!$payable || !($remitment = $payable->remitment)) |
|
206 | 206 | { |
207 | 207 | return; |
208 | 208 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $remitment->auction()->delete(); |
213 | 213 | $remitment->delete(); |
214 | 214 | // Detach from the session, but only if the remitment was not planned. |
215 | - if(!$pool->remit_planned || $pool->remit_auction) |
|
215 | + if (!$pool->remit_planned || $pool->remit_auction) |
|
216 | 216 | { |
217 | 217 | $payable->session()->dissociate(); |
218 | 218 | $payable->save(); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ->with(['payable', 'member']) |
238 | 238 | ->select('subscriptions.*') |
239 | 239 | ->get(); |
240 | - if($pool->remit_planned && !$pool->remit_auction) |
|
240 | + if ($pool->remit_planned && !$pool->remit_auction) |
|
241 | 241 | { |
242 | 242 | // Only the beneficiaries that are not yet planned. |
243 | 243 | return $subscriptions |
@@ -34,13 +34,13 @@ |
||
34 | 34 | 'amount' => 'required|regex:/^\d+(\.\d{1,2})?$/', |
35 | 35 | 'fund' => 'required|integer|min:0', |
36 | 36 | ]); |
37 | - if($validator->fails()) |
|
37 | + if ($validator->fails()) |
|
38 | 38 | { |
39 | 39 | throw new ValidationException($validator); |
40 | 40 | } |
41 | 41 | |
42 | 42 | $validated = $validator->validated(); |
43 | - $validated['amount'] = $this->localeService->convertMoneyToInt((float)$validated['amount']); |
|
43 | + $validated['amount'] = $this->localeService->convertMoneyToInt((float) $validated['amount']); |
|
44 | 44 | return $validated; |
45 | 45 | } |
46 | 46 | } |
@@ -46,9 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | protected function getFundId() |
48 | 48 | { |
49 | - $this->fundId = (int)($this->target()->method() === 'home' ? |
|
50 | - $this->target()->args()[0] : |
|
51 | - $this->bag('meeting.saving')->get('fund.id', 0)); |
|
49 | + $this->fundId = (int) ($this->target()->method() === 'home' ? |
|
50 | + $this->target()->args()[0] : $this->bag('meeting.saving')->get('fund.id', 0)); |
|
52 | 51 | } |
53 | 52 | |
54 | 53 | /** |
@@ -137,7 +136,7 @@ discard block |
||
137 | 136 | */ |
138 | 137 | public function editSaving(int $memberId) |
139 | 138 | { |
140 | - if($this->session->closed) |
|
139 | + if ($this->session->closed) |
|
141 | 140 | { |
142 | 141 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
143 | 142 | return $this->response; |
@@ -170,14 +169,14 @@ discard block |
||
170 | 169 | */ |
171 | 170 | public function saveSaving(int $memberId, string $amount) |
172 | 171 | { |
173 | - if($this->session->closed) |
|
172 | + if ($this->session->closed) |
|
174 | 173 | { |
175 | 174 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
176 | 175 | return $this->response; |
177 | 176 | } |
178 | 177 | |
179 | 178 | $amount = str_replace(',', '.', trim($amount)); |
180 | - if($amount === '') |
|
179 | + if ($amount === '') |
|
181 | 180 | { |
182 | 181 | $this->savingService->deleteSaving($this->session, 0, $memberId); |
183 | 182 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function getRounds(int $page = 0): Collection |
35 | 35 | { |
36 | - if(!($tontine = $this->tenantService->tontine())) |
|
36 | + if (!($tontine = $this->tenantService->tontine())) |
|
37 | 37 | { |
38 | 38 | return collect([]); |
39 | 39 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $tontine->rounds()->where('id', $roundId)->delete(); |
116 | 116 | }); |
117 | 117 | } |
118 | - catch(Exception $e) |
|
118 | + catch (Exception $e) |
|
119 | 119 | { |
120 | 120 | throw new MessageException(trans('tontine.round.errors.delete')); |
121 | 121 | } |
@@ -114,8 +114,7 @@ |
||
114 | 114 | $tontine->sessions()->where('round_id', $roundId)->delete(); |
115 | 115 | $tontine->rounds()->where('id', $roundId)->delete(); |
116 | 116 | }); |
117 | - } |
|
118 | - catch(Exception $e) |
|
117 | + } catch(Exception $e) |
|
119 | 118 | { |
120 | 119 | throw new MessageException(trans('tontine.round.errors.delete')); |
121 | 120 | } |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | $figures->cashier->recv = $cashier; |
47 | 47 | |
48 | 48 | $depositCount = !$deposit ? 0 : $deposit->total; |
49 | - $depositAmount = $pool->deposit_fixed ? $pool->amount * $depositCount : |
|
50 | - (!$deposit ? 0 : $deposit->amount); |
|
49 | + $depositAmount = $pool->deposit_fixed ? $pool->amount * $depositCount : (!$deposit ? 0 : $deposit->amount); |
|
51 | 50 | |
52 | 51 | $figures->deposit->amount += $depositAmount; |
53 | 52 | $figures->cashier->recv += $depositAmount; |
@@ -55,8 +54,7 @@ discard block |
||
55 | 54 | |
56 | 55 | $sessionCount = $pool->counter->sessions - $pool->counter->disabled_sessions; |
57 | 56 | $remitmentCount = !$remitment ? 0 : $remitment->total; |
58 | - $remitmentAmount = !$pool->deposit_fixed ? $depositAmount : |
|
59 | - $pool->amount * $sessionCount * $remitmentCount; |
|
57 | + $remitmentAmount = !$pool->deposit_fixed ? $depositAmount : $pool->amount * $sessionCount * $remitmentCount; |
|
60 | 58 | |
61 | 59 | $figures->cashier->end = $figures->cashier->recv; |
62 | 60 | $figures->remitment->amount += $remitmentAmount; |
@@ -80,9 +78,9 @@ discard block |
||
80 | 78 | { |
81 | 79 | $cashier = 0; |
82 | 80 | $collectedFigures = []; |
83 | - foreach($sessions as $session) |
|
81 | + foreach ($sessions as $session) |
|
84 | 82 | { |
85 | - if(($disabledSessions && $disabledSessions->has($session->id)) || $session->pending) |
|
83 | + if (($disabledSessions && $disabledSessions->has($session->id)) || $session->pending) |
|
86 | 84 | { |
87 | 85 | $collectedFigures[$session->id] = $this->makeFigures(' '); |
88 | 86 | continue; |
@@ -149,11 +147,10 @@ discard block |
||
149 | 147 | return $pools->map(function($pool) use($allSessions, $deposits, $remitments, $disabledSessions) { |
150 | 148 | $disabledSessions = $disabledSessions[$pool->id] ?? null; |
151 | 149 | // Enabled sessions |
152 | - $sessions = !$disabledSessions ? $allSessions : |
|
153 | - $allSessions->filter(fn($session) => !$disabledSessions->has($session->id)); |
|
150 | + $sessions = !$disabledSessions ? $allSessions : $allSessions->filter(fn($session) => !$disabledSessions->has($session->id)); |
|
154 | 151 | |
155 | 152 | $figures = new stdClass(); |
156 | - if($pool->remit_planned) |
|
153 | + if ($pool->remit_planned) |
|
157 | 154 | { |
158 | 155 | $depositCount = $pool->subscriptions()->count(); |
159 | 156 | $figures->expected = $this->getExpectedFigures($pool, $sessions, $depositCount); |
@@ -172,7 +169,7 @@ discard block |
||
172 | 169 | */ |
173 | 170 | public function getSessionRemitmentCount(Pool $pool, Session $session): int |
174 | 171 | { |
175 | - if(!$pool->deposit_fixed) |
|
172 | + if (!$pool->deposit_fixed) |
|
176 | 173 | { |
177 | 174 | return 1; |
178 | 175 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @return Builder|Relation |
49 | 49 | */ |
50 | - private function getQuery(string $search = ''): Builder|Relation |
|
50 | + private function getQuery(string $search = ''): Builder | Relation |
|
51 | 51 | { |
52 | 52 | return $this->tenantService->tontine()->members() |
53 | 53 | ->when($this->filterActive, fn(Builder $query) => $query->active()) |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | private function saveActiveMembers() |
118 | 118 | { |
119 | - if(!($tontine = $this->tenantService->tontine()) || |
|
119 | + if (!($tontine = $this->tenantService->tontine()) || |
|
120 | 120 | !($round = $this->tenantService->round())) |
121 | 121 | { |
122 | 122 | return; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | // The number of active members is saved in the round, so its current |
137 | 137 | // value can be retrieved forever, even when the membership will change. |
138 | 138 | $round = $this->tenantService->round(); |
139 | - if(!isset($round->properties['members'])) |
|
139 | + if (!isset($round->properties['members'])) |
|
140 | 140 | { |
141 | 141 | // Create and save the property with the content |
142 | 142 | $this->saveActiveMembers(); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $tontine = $this->tenantService->tontine(); |
180 | 180 | $members = $tontine->members()->createMany($values); |
181 | 181 | // Create members bills |
182 | - foreach($members as $member) |
|
182 | + foreach ($members as $member) |
|
183 | 183 | { |
184 | 184 | $this->memberCreated($tontine, $member); |
185 | 185 | } |