@@ -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; |