@@ -84,8 +84,7 @@ |
||
84 | 84 | { |
85 | 85 | $relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : []; |
86 | 86 | return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find(\Auth::id(), $relations), 200); |
87 | - } |
|
88 | - else |
|
87 | + } else |
|
89 | 88 | { |
90 | 89 | $error = $this->errorHandler->loginFailed(); |
91 | 90 | abort($error['status'], $error['message']); |
@@ -213,8 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | } |
215 | 215 | $relations[$relation][] = $relationModel; |
216 | - } |
|
217 | - else |
|
216 | + } else |
|
218 | 217 | { |
219 | 218 | if (gettype($val) !== 'object' && gettype($val) !== 'array') |
220 | 219 | { |
@@ -234,8 +233,7 @@ discard block |
||
234 | 233 | } |
235 | 234 | } |
236 | 235 | } |
237 | - } |
|
238 | - else if (array_search($key, $model->getFillable(), true) !== false) |
|
236 | + } else if (array_search($key, $model->getFillable(), true) !== false) |
|
239 | 237 | { |
240 | 238 | $model->$key = $value; |
241 | 239 | } |
@@ -247,8 +245,7 @@ discard block |
||
247 | 245 | if ($value == 'delete' && $model->$key()->count()) |
248 | 246 | { |
249 | 247 | $model->$key()->delete(); |
250 | - } |
|
251 | - else if (gettype($value) == 'array') |
|
248 | + } else if (gettype($value) == 'array') |
|
252 | 249 | { |
253 | 250 | $ids = []; |
254 | 251 | foreach ($value as $val) |
@@ -279,8 +276,7 @@ discard block |
||
279 | 276 | $model->$key()->attach($ids); |
280 | 277 | break; |
281 | 278 | } |
282 | - } |
|
283 | - else |
|
279 | + } else |
|
284 | 280 | { |
285 | 281 | switch (class_basename($model->$key())) |
286 | 282 | { |
@@ -358,8 +354,7 @@ discard block |
||
358 | 354 | $model->delete(); |
359 | 355 | $saveLog ? $this->logs->saveLog('delete', class_basename($this->model), $this->getModel(), $value, $model) : false; |
360 | 356 | }); |
361 | - } |
|
362 | - else |
|
357 | + } else |
|
363 | 358 | { |
364 | 359 | \DB::transaction(function () use ($value, $attribute, &$result, $saveLog) { |
365 | 360 | call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model){ |
@@ -432,13 +427,11 @@ discard block |
||
432 | 427 | { |
433 | 428 | $conditionString .= str_replace('{op}', 'and', $this->constructConditions($value)['conditionString']) . ' {op} '; |
434 | 429 | $conditionValues = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']); |
435 | - } |
|
436 | - else if ($key == 'or') |
|
430 | + } else if ($key == 'or') |
|
437 | 431 | { |
438 | 432 | $conditionString .= str_replace('{op}', 'or', $this->constructConditions($value)['conditionString']) . ' {op} '; |
439 | 433 | $conditionValues = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']); |
440 | - } |
|
441 | - else |
|
434 | + } else |
|
442 | 435 | { |
443 | 436 | $conditionString .= $key . '=? {op} '; |
444 | 437 | $conditionValues[] = $value; |
@@ -190,8 +190,7 @@ discard block |
||
190 | 190 | if ($request->has('id')) |
191 | 191 | { |
192 | 192 | $rule = str_replace('{id}', $request->get('id'), $rule); |
193 | - } |
|
194 | - else |
|
193 | + } else |
|
195 | 194 | { |
196 | 195 | $rule = str_replace(',{id}', '', $rule); |
197 | 196 | } |
@@ -232,8 +231,7 @@ discard block |
||
232 | 231 | { |
233 | 232 | $error = $this->errorHandler->notFound('method'); |
234 | 233 | abort($error['status'], $error['message']); |
235 | - } |
|
236 | - else if ( ! in_array($permission, $this->skipLoginCheck)) |
|
234 | + } else if ( ! in_array($permission, $this->skipLoginCheck)) |
|
237 | 235 | { |
238 | 236 | \JWTAuth::parseToken()->authenticate(); |
239 | 237 | if ( ! in_array($permission, $this->skipPermissionCheck) && ! \Core::users()->can($permission, $this->model)) |