@@ -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 | } |
@@ -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; |
@@ -103,24 +103,19 @@ discard block |
||
103 | 103 | if ( ! $user = $this->first(['email' => $credentials['email']])) |
104 | 104 | { |
105 | 105 | \ErrorHandler::loginFailed(); |
106 | - } |
|
107 | - else if ($adminLogin && $user->groups->pluck('name')->search('Admin', true) === false) |
|
106 | + } else if ($adminLogin && $user->groups->pluck('name')->search('Admin', true) === false) |
|
108 | 107 | { |
109 | 108 | \ErrorHandler::loginFailed(); |
110 | - } |
|
111 | - else if ( ! $adminLogin && $user->groups->pluck('name')->search('Admin', true) !== false) |
|
109 | + } else if ( ! $adminLogin && $user->groups->pluck('name')->search('Admin', true) !== false) |
|
112 | 110 | { |
113 | 111 | \ErrorHandler::loginFailed(); |
114 | - } |
|
115 | - else if ($user->blocked) |
|
112 | + } else if ($user->blocked) |
|
116 | 113 | { |
117 | 114 | \ErrorHandler::userIsBlocked(); |
118 | - } |
|
119 | - else if ($token = \JWTAuth::attempt($credentials)) |
|
115 | + } else if ($token = \JWTAuth::attempt($credentials)) |
|
120 | 116 | { |
121 | 117 | return ['token' => $token]; |
122 | - } |
|
123 | - else |
|
118 | + } else |
|
124 | 119 | { |
125 | 120 | \ErrorHandler::loginFailed(); |
126 | 121 | } |
@@ -146,8 +141,7 @@ discard block |
||
146 | 141 | { |
147 | 142 | $data = ['email' => $user->email, 'password' => '']; |
148 | 143 | return $this->register($data); |
149 | - } |
|
150 | - else |
|
144 | + } else |
|
151 | 145 | { |
152 | 146 | if ( ! \Auth::attempt(['email' => $registeredUser->email, 'password' => ''])) |
153 | 147 | { |
@@ -193,12 +187,10 @@ discard block |
||
193 | 187 | if ( ! $this->hasGroup('Admin')) |
194 | 188 | { |
195 | 189 | \ErrorHandler::noPermissions(); |
196 | - } |
|
197 | - else if (\JWTAuth::parseToken()->authenticate()->id == $user_id) |
|
190 | + } else if (\JWTAuth::parseToken()->authenticate()->id == $user_id) |
|
198 | 191 | { |
199 | 192 | \ErrorHandler::noPermissions(); |
200 | - } |
|
201 | - else if ($user->groups->pluck('name')->search('Admin', true) !== false) |
|
193 | + } else if ($user->groups->pluck('name')->search('Admin', true) !== false) |
|
202 | 194 | { |
203 | 195 | \ErrorHandler::noPermissions(); |
204 | 196 | } |