@@ -170,8 +170,7 @@ |
||
170 | 170 | if ($request->has('id')) |
171 | 171 | { |
172 | 172 | $rule = str_replace('{id}', $request->get('id'), $rule); |
173 | - } |
|
174 | - else |
|
173 | + } else |
|
175 | 174 | { |
176 | 175 | $rule = str_replace(',{id}', '', $rule); |
177 | 176 | } |
@@ -76,24 +76,19 @@ discard block |
||
76 | 76 | if ( ! $user = $this->first(['email' => $credentials['email']])) |
77 | 77 | { |
78 | 78 | \ErrorHandler::loginFailed(); |
79 | - } |
|
80 | - else if ($adminLogin && $user->groups->lists('name')->search('Admin', true) === false) |
|
79 | + } else if ($adminLogin && $user->groups->lists('name')->search('Admin', true) === false) |
|
81 | 80 | { |
82 | 81 | \ErrorHandler::loginFailed(); |
83 | - } |
|
84 | - else if ( ! $adminLogin && $user->groups->lists('name')->search('Admin', true) !== false) |
|
82 | + } else if ( ! $adminLogin && $user->groups->lists('name')->search('Admin', true) !== false) |
|
85 | 83 | { |
86 | 84 | \ErrorHandler::loginFailed(); |
87 | - } |
|
88 | - else if ($user->blocked) |
|
85 | + } else if ($user->blocked) |
|
89 | 86 | { |
90 | 87 | \ErrorHandler::userIsBlocked(); |
91 | - } |
|
92 | - else if ($token = \JWTAuth::attempt($credentials)) |
|
88 | + } else if ($token = \JWTAuth::attempt($credentials)) |
|
93 | 89 | { |
94 | 90 | return ['token' => $token]; |
95 | - } |
|
96 | - else |
|
91 | + } else |
|
97 | 92 | { |
98 | 93 | \ErrorHandler::loginFailed(); |
99 | 94 | } |
@@ -118,8 +113,7 @@ discard block |
||
118 | 113 | { |
119 | 114 | $data = ['email' => $user->email, 'password' => '']; |
120 | 115 | return $this->register($data); |
121 | - } |
|
122 | - else |
|
116 | + } else |
|
123 | 117 | { |
124 | 118 | return $this->login(['email' => $registeredUser->email, 'password' => ''], false); |
125 | 119 | } |
@@ -161,12 +155,10 @@ discard block |
||
161 | 155 | if ( ! $this->hasGroup('Admin')) |
162 | 156 | { |
163 | 157 | \ErrorHandler::noPermissions(); |
164 | - } |
|
165 | - else if (\JWTAuth::parseToken()->authenticate()->id == $user_id) |
|
158 | + } else if (\JWTAuth::parseToken()->authenticate()->id == $user_id) |
|
166 | 159 | { |
167 | 160 | \ErrorHandler::noPermissions(); |
168 | - } |
|
169 | - else if ($user->groups->lists('name')->search('Admin', true) !== false) |
|
161 | + } else if ($user->groups->lists('name')->search('Admin', true) !== false) |
|
170 | 162 | { |
171 | 163 | \ErrorHandler::noPermissions(); |
172 | 164 | } |
@@ -38,8 +38,7 @@ discard block |
||
38 | 38 | if ( ! $report) |
39 | 39 | { |
40 | 40 | \ErrorHandler::notFound('report'); |
41 | - } |
|
42 | - else if ( ! \Core::users()->can($report->view_name, 'reports')) |
|
41 | + } else if ( ! \Core::users()->can($report->view_name, 'reports')) |
|
43 | 42 | { |
44 | 43 | \ErrorHandler::noPermissions(); |
45 | 44 | } |
@@ -60,8 +59,7 @@ discard block |
||
60 | 59 | if ($perPage) |
61 | 60 | { |
62 | 61 | return $report->paginate($perPage); |
63 | - } |
|
64 | - else |
|
62 | + } else |
|
65 | 63 | { |
66 | 64 | return $report->get(); |
67 | 65 | } |
@@ -425,8 +425,7 @@ discard block |
||
425 | 425 | $model = $this->model->lockForUpdate()->find($value); |
426 | 426 | $model ? $model->update($data) : 0; |
427 | 427 | $saveLog ? \Logging::saveLog('update', class_basename($this->model), $this->getModel(), $value, $model) : false; |
428 | - } |
|
429 | - else |
|
428 | + } else |
|
430 | 429 | { |
431 | 430 | call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model) use ($data, $saveLog){ |
432 | 431 | $model->update($data); |
@@ -457,8 +456,7 @@ discard block |
||
457 | 456 | $model->delete(); |
458 | 457 | $saveLog ? \Logging::saveLog('delete', class_basename($this->model), $this->getModel(), $value, $model) : false; |
459 | 458 | }); |
460 | - } |
|
461 | - else |
|
459 | + } else |
|
462 | 460 | { |
463 | 461 | \DB::transaction(function () use ($value, $attribute, &$result, $saveLog) { |
464 | 462 | call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model){ |
@@ -531,13 +529,11 @@ discard block |
||
531 | 529 | { |
532 | 530 | $conditionString .= str_replace('{op}', 'and', $this->constructConditions($value)['conditionString']) . ' {op} '; |
533 | 531 | $conditionValues = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']); |
534 | - } |
|
535 | - else if ($key == 'or') |
|
532 | + } else if ($key == 'or') |
|
536 | 533 | { |
537 | 534 | $conditionString .= str_replace('{op}', 'or', $this->constructConditions($value)['conditionString']) . ' {op} '; |
538 | 535 | $conditionValues = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']); |
539 | - } |
|
540 | - else |
|
536 | + } else |
|
541 | 537 | { |
542 | 538 | if (is_array($value)) |
543 | 539 | { |
@@ -546,13 +542,11 @@ discard block |
||
546 | 542 | { |
547 | 543 | $value1 = $value['val1']; |
548 | 544 | $value2 = $value['val2']; |
549 | - } |
|
550 | - else |
|
545 | + } else |
|
551 | 546 | { |
552 | 547 | $value = $value['val']; |
553 | 548 | } |
554 | - } |
|
555 | - else |
|
549 | + } else |
|
556 | 550 | { |
557 | 551 | $operator = '='; |
558 | 552 | } |
@@ -564,8 +558,7 @@ discard block |
||
564 | 558 | |
565 | 559 | $conditionString .= $key . '<=? {op} '; |
566 | 560 | $conditionValues[] = $value2; |
567 | - } |
|
568 | - else |
|
561 | + } else |
|
569 | 562 | { |
570 | 563 | $conditionString .= $key . $operator . '? {op} '; |
571 | 564 | $conditionValues[] = $value; |