@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | protected function commands() |
27 | 27 | { |
28 | - $this->load(__DIR__.'/Commands'); |
|
28 | + $this->load(__DIR__ . '/Commands'); |
|
29 | 29 | |
30 | 30 | require base_path('routes/console.php'); |
31 | 31 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | $this->configureRateLimiting(); |
30 | 30 | |
31 | - $this->routes(function () { |
|
31 | + $this->routes(function() { |
|
32 | 32 | Route::middleware('api') |
33 | 33 | ->prefix('api') |
34 | 34 | ->group(base_path('routes/api.php')); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function configureRateLimiting() |
47 | 47 | { |
48 | - RateLimiter::for('api', function (Request $request) { |
|
48 | + RateLimiter::for ('api', function(Request $request) { |
|
49 | 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); |
50 | 50 | }); |
51 | 51 | } |
@@ -49,13 +49,13 @@ |
||
49 | 49 | Fortify::updateUserPasswordsUsing(UpdateUserPassword::class); |
50 | 50 | Fortify::resetUserPasswordsUsing(ResetUserPassword::class); |
51 | 51 | |
52 | - RateLimiter::for('login', function(Request $request) { |
|
52 | + RateLimiter::for ('login', function(Request $request) { |
|
53 | 53 | $email = (string) $request->email; |
54 | 54 | |
55 | - return Limit::perMinute(5)->by($email.$request->ip()); |
|
55 | + return Limit::perMinute(5)->by($email . $request->ip()); |
|
56 | 56 | }); |
57 | 57 | |
58 | - RateLimiter::for('two-factor', function(Request $request) { |
|
58 | + RateLimiter::for ('two-factor', function(Request $request) { |
|
59 | 59 | return Limit::perMinute(5)->by($request->session()->get('login.id')); |
60 | 60 | }); |
61 | 61 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | // Force redirect to HTTPS. |
30 | 30 | $url = $this->app['url']; |
31 | - if($this->app->environment('production')) |
|
31 | + if ($this->app->environment('production')) |
|
32 | 32 | { |
33 | 33 | $url->forceScheme('https'); |
34 | 34 | } |
@@ -36,10 +36,10 @@ |
||
36 | 36 | { |
37 | 37 | return parent::handle($request, $next); |
38 | 38 | } |
39 | - catch(TokenMismatchException $e) |
|
39 | + catch (TokenMismatchException $e) |
|
40 | 40 | { |
41 | 41 | $jaxon = App::make(Jaxon::class); |
42 | - if($jaxon->canProcessRequest()) // We have an ajax request with Jaxon |
|
42 | + if ($jaxon->canProcessRequest()) // We have an ajax request with Jaxon |
|
43 | 43 | { |
44 | 44 | throw new AuthenticationException(); |
45 | 45 | } |
@@ -35,14 +35,15 @@ |
||
35 | 35 | try |
36 | 36 | { |
37 | 37 | return parent::handle($request, $next); |
38 | - } |
|
39 | - catch(TokenMismatchException $e) |
|
38 | + } catch(TokenMismatchException $e) |
|
40 | 39 | { |
41 | 40 | $jaxon = App::make(Jaxon::class); |
42 | - if($jaxon->canProcessRequest()) // We have an ajax request with Jaxon |
|
41 | + if($jaxon->canProcessRequest()) { |
|
42 | + // We have an ajax request with Jaxon |
|
43 | 43 | { |
44 | 44 | throw new AuthenticationException(); |
45 | 45 | } |
46 | + } |
|
46 | 47 | |
47 | 48 | throw $e; |
48 | 49 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | protected function unauthenticated($request, array $guards) |
22 | 22 | { |
23 | 23 | $jaxon = App::make(Jaxon::class); |
24 | - if($jaxon->canProcessRequest()) // We have an ajax request with Jaxon |
|
24 | + if ($jaxon->canProcessRequest()) // We have an ajax request with Jaxon |
|
25 | 25 | { |
26 | 26 | throw new \Siak\Tontine\Exception\AuthenticationException(); |
27 | 27 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function redirectTo($request) |
41 | 41 | { |
42 | - if (! $request->expectsJson()) { |
|
42 | + if (!$request->expectsJson()) { |
|
43 | 43 | return route('login'); |
44 | 44 | } |
45 | 45 | } |
@@ -21,10 +21,12 @@ |
||
21 | 21 | protected function unauthenticated($request, array $guards) |
22 | 22 | { |
23 | 23 | $jaxon = App::make(Jaxon::class); |
24 | - if($jaxon->canProcessRequest()) // We have an ajax request with Jaxon |
|
24 | + if($jaxon->canProcessRequest()) { |
|
25 | + // We have an ajax request with Jaxon |
|
25 | 26 | { |
26 | 27 | throw new \Siak\Tontine\Exception\AuthenticationException(); |
27 | 28 | } |
29 | + } |
|
28 | 30 | |
29 | 31 | throw new AuthenticationException( |
30 | 32 | 'Unauthenticated.', $guards, $this->redirectTo($request) |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | private function getChargeTypes(int $group = -1) |
67 | 67 | { |
68 | - if($group < 0) |
|
68 | + if ($group < 0) |
|
69 | 69 | { |
70 | 70 | // All possible values |
71 | 71 | return [ |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | private function getChargePeriods(int $group = -1) |
87 | 87 | { |
88 | - if($group < 0) |
|
88 | + if ($group < 0) |
|
89 | 89 | { |
90 | 90 | // All possible values |
91 | 91 | return [ |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | 'title' => trans('common.actions.cancel'), |
145 | 145 | 'class' => 'btn btn-tertiary', |
146 | 146 | 'click' => 'close', |
147 | - ],[ |
|
147 | + ], [ |
|
148 | 148 | 'title' => trans('common.actions.add'), |
149 | 149 | 'class' => 'btn btn-primary', |
150 | 150 | 'click' => $this->rq()->add($group), |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | 'title' => trans('common.actions.cancel'), |
177 | 177 | 'class' => 'btn btn-tertiary', |
178 | 178 | 'click' => 'close', |
179 | - ],[ |
|
179 | + ], [ |
|
180 | 180 | 'title' => trans('common.actions.save'), |
181 | 181 | 'class' => 'btn btn-primary', |
182 | 182 | 'click' => $this->rq()->create($group, pm()->form('charge-form')), |
@@ -191,19 +191,19 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function create(int $group, array $formValues) |
193 | 193 | { |
194 | - if($group !== self::GROUP_FIXED && $group !== self::GROUP_VARIABLE) |
|
194 | + if ($group !== self::GROUP_FIXED && $group !== self::GROUP_VARIABLE) |
|
195 | 195 | { |
196 | 196 | $this->response; |
197 | 197 | } |
198 | 198 | // Set the missing field in each item of the charge array. |
199 | - if($group === self::GROUP_FIXED) // Fixed charge |
|
199 | + if ($group === self::GROUP_FIXED) // Fixed charge |
|
200 | 200 | { |
201 | 201 | $formValues['type'] = ChargeModel::TYPE_FEE; |
202 | 202 | } |
203 | - if($group === self::GROUP_VARIABLE) // Variable charge |
|
203 | + if ($group === self::GROUP_VARIABLE) // Variable charge |
|
204 | 204 | { |
205 | 205 | $formValues['period'] = ChargeModel::PERIOD_NONE; |
206 | - if(empty($formValues['fixed'])) |
|
206 | + if (empty($formValues['fixed'])) |
|
207 | 207 | { |
208 | 208 | $formValues['amount'] = 0; |
209 | 209 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | 'title' => trans('common.actions.cancel'), |
239 | 239 | 'class' => 'btn btn-tertiary', |
240 | 240 | 'click' => 'close', |
241 | - ],[ |
|
241 | + ], [ |
|
242 | 242 | 'title' => trans('common.actions.save'), |
243 | 243 | 'class' => 'btn btn-primary', |
244 | 244 | 'click' => $this->rq()->update($charge->id, pm()->form('charge-form')), |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | // These fields cannot be changed |
259 | 259 | $formValues['type'] = $charge->type; |
260 | 260 | $formValues['period'] = $charge->period; |
261 | - if(empty($formValues['fixed'])) |
|
261 | + if (empty($formValues['fixed'])) |
|
262 | 262 | { |
263 | 263 | $formValues['amount'] = 0; |
264 | 264 | } |
@@ -196,13 +196,17 @@ |
||
196 | 196 | $this->response; |
197 | 197 | } |
198 | 198 | // Set the missing field in each item of the charge array. |
199 | - if($group === self::GROUP_FIXED) // Fixed charge |
|
199 | + if($group === self::GROUP_FIXED) { |
|
200 | + // Fixed charge |
|
200 | 201 | { |
201 | 202 | $formValues['type'] = ChargeModel::TYPE_FEE; |
202 | 203 | } |
203 | - if($group === self::GROUP_VARIABLE) // Variable charge |
|
204 | + } |
|
205 | + if($group === self::GROUP_VARIABLE) { |
|
206 | + // Variable charge |
|
204 | 207 | { |
205 | 208 | $formValues['period'] = ChargeModel::PERIOD_NONE; |
209 | + } |
|
206 | 210 | if(empty($formValues['fixed'])) |
207 | 211 | { |
208 | 212 | $formValues['amount'] = 0; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'title' => trans('common.actions.cancel'), |
80 | 80 | 'class' => 'btn btn-tertiary', |
81 | 81 | 'click' => 'close', |
82 | - ],[ |
|
82 | + ], [ |
|
83 | 83 | 'title' => trans('common.actions.save'), |
84 | 84 | 'class' => 'btn btn-primary', |
85 | 85 | 'click' => $this->rq()->create(pm()->form('member-form')), |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | 'click' => 'close', |
113 | 113 | ]]; |
114 | 114 | $useFaker = config('jaxon.app.faker', false); |
115 | - if($useFaker) |
|
115 | + if ($useFaker) |
|
116 | 116 | { |
117 | 117 | $buttons[] = [ |
118 | 118 | 'title' => '<i class="fa fa-fill"></i>', |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | $members = array_map(function($value) { |
141 | 141 | $values = explode(";", trim($value, " \t\n\r;")); |
142 | - if(count($values) === 0 || trim($values[0]) === '') |
|
142 | + if (count($values) === 0 || trim($values[0]) === '') |
|
143 | 143 | { |
144 | 144 | return []; |
145 | 145 | } |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | 'phone' => '', |
150 | 150 | ]; |
151 | 151 | // The next values are either the phone number or the email, in any order. |
152 | - foreach([1, 2] as $count) |
|
152 | + foreach ([1, 2] as $count) |
|
153 | 153 | { |
154 | - if(count($values) > $count) |
|
154 | + if (count($values) > $count) |
|
155 | 155 | { |
156 | 156 | $field = strpos($values[$count], '@') !== false ? 'email' : 'phone'; |
157 | 157 | $member[$field] = trim($values[$count]); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | 'title' => trans('common.actions.cancel'), |
194 | 194 | 'class' => 'btn btn-tertiary', |
195 | 195 | 'click' => 'close', |
196 | - ],[ |
|
196 | + ], [ |
|
197 | 197 | 'title' => trans('common.actions.save'), |
198 | 198 | 'class' => 'btn btn-primary', |
199 | 199 | 'click' => $this->rq()->update($member->id, pm()->form('member-form')), |
@@ -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)); |