@@ -49,8 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | protected function getPool() |
| 51 | 51 | { |
| 52 | - $poolId = $this->target()->method() === 'home' ? $this->target()->args()[0] : |
|
| 53 | - intval($this->bag('subscription')->get('pool.id')); |
|
| 52 | + $poolId = $this->target()->method() === 'home' ? $this->target()->args()[0] : intval($this->bag('subscription')->get('pool.id')); |
|
| 54 | 53 | $this->pool = $this->poolService->getPool($poolId); |
| 55 | 54 | } |
| 56 | 55 | |
@@ -69,7 +68,7 @@ discard block |
||
| 69 | 68 | ->with('pool', $this->pool); |
| 70 | 69 | $this->response->html('pool-subscription-sessions', $html); |
| 71 | 70 | $this->jq('#btn-subscription-sessions-refresh')->click($this->rq()->home($poolId)); |
| 72 | - if($this->pool->remit_planned) |
|
| 71 | + if ($this->pool->remit_planned) |
|
| 73 | 72 | { |
| 74 | 73 | $this->jq('#btn-subscription-planning') |
| 75 | 74 | ->click($this->cl(Subscription::class)->rq()->planning($poolId)); |
@@ -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 | } |
@@ -196,14 +196,14 @@ discard block |
||
| 196 | 196 | $query = DB::table('settlements') |
| 197 | 197 | ->select(DB::raw('count(*) as total'), DB::raw('sum(bills.amount) as amount')) |
| 198 | 198 | ->join('bills', 'settlements.bill_id', '=', 'bills.id'); |
| 199 | - if($charge->is_variable) |
|
| 199 | + if ($charge->is_variable) |
|
| 200 | 200 | { |
| 201 | 201 | return $query->join('libre_bills', 'libre_bills.bill_id', '=', 'bills.id') |
| 202 | 202 | ->where('settlements.session_id', $session->id) |
| 203 | 203 | ->where('libre_bills.charge_id', $charge->id) |
| 204 | 204 | ->first(); |
| 205 | 205 | } |
| 206 | - if($charge->period_session) |
|
| 206 | + if ($charge->period_session) |
|
| 207 | 207 | { |
| 208 | 208 | // For session charges, count the bills in the current session that are settled. |
| 209 | 209 | return $query->join('session_bills', 'session_bills.bill_id', '=', 'bills.id') |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | ->where('session_bills.session_id', $session->id) |
| 212 | 212 | ->first(); |
| 213 | 213 | } |
| 214 | - if($charge->period_round) |
|
| 214 | + if ($charge->period_round) |
|
| 215 | 215 | { |
| 216 | 216 | return $query->join('round_bills', 'round_bills.bill_id', '=', 'bills.id') |
| 217 | 217 | ->where('settlements.session_id', $session->id) |