@@ -621,14 +621,12 @@ discard block |
||
| 621 | 621 | $conditions = $this->constructConditions($value, $model); |
| 622 | 622 | $conditionString .= str_replace('{op}', 'and', $conditions['conditionString']).' {op} '; |
| 623 | 623 | $conditionValues = array_merge($conditionValues, $conditions['conditionValues']); |
| 624 | - } |
|
| 625 | - else if ($key == 'or') |
|
| 624 | + } else if ($key == 'or') |
|
| 626 | 625 | { |
| 627 | 626 | $conditions = $this->constructConditions($value, $model); |
| 628 | 627 | $conditionString .= str_replace('{op}', 'or', $conditions['conditionString']).' {op} '; |
| 629 | 628 | $conditionValues = array_merge($conditionValues, $conditions['conditionValues']); |
| 630 | - } |
|
| 631 | - else |
|
| 629 | + } else |
|
| 632 | 630 | { |
| 633 | 631 | if (is_array($value)) |
| 634 | 632 | { |
@@ -653,29 +651,24 @@ discard block |
||
| 653 | 651 | |
| 654 | 652 | $conditionString .= $key.' <= ? {op} '; |
| 655 | 653 | $conditionValues[] = $value2; |
| 656 | - } |
|
| 657 | - elseif (strtolower($operator) == 'in') |
|
| 654 | + } elseif (strtolower($operator) == 'in') |
|
| 658 | 655 | { |
| 659 | 656 | $conditionValues = array_merge($conditionValues, $value); |
| 660 | 657 | $inBindingsString = rtrim(str_repeat('?,', count($value)), ','); |
| 661 | 658 | $conditionString .= $key.' in ('.rtrim($inBindingsString, ',').') {op} '; |
| 662 | - } |
|
| 663 | - elseif (strtolower($operator) == 'null') |
|
| 659 | + } elseif (strtolower($operator) == 'null') |
|
| 664 | 660 | { |
| 665 | 661 | $conditionString .= $key.' is null {op} '; |
| 666 | - } |
|
| 667 | - elseif (strtolower($operator) == 'not null') |
|
| 662 | + } elseif (strtolower($operator) == 'not null') |
|
| 668 | 663 | { |
| 669 | 664 | $conditionString .= $key.' is not null {op} '; |
| 670 | - } |
|
| 671 | - elseif (strtolower($operator) == 'has') |
|
| 665 | + } elseif (strtolower($operator) == 'has') |
|
| 672 | 666 | { |
| 673 | 667 | $sql = $model->withTrashed()->has($key)->toSql(); |
| 674 | 668 | $conditions = $this->constructConditions($value, $model->$key()->getRelated()); |
| 675 | 669 | $conditionString .= rtrim(substr($sql, strpos($sql, 'exists')), ')').' and '.$conditions['conditionString'].') {op} '; |
| 676 | 670 | $conditionValues = array_merge($conditionValues, $conditions['conditionValues']); |
| 677 | - } |
|
| 678 | - else |
|
| 671 | + } else |
|
| 679 | 672 | { |
| 680 | 673 | $conditionString .= $key.' '.$operator.' ? {op} '; |
| 681 | 674 | $conditionValues[] = $value; |
@@ -227,10 +227,8 @@ |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->model))) |
| 230 | - {} |
|
| 231 | - elseif ( ! $isPasswordClient && $user->tokenCan($this->model.'-'.$permission)) |
|
| 232 | - {} |
|
| 233 | - else |
|
| 230 | + {} elseif ( ! $isPasswordClient && $user->tokenCan($this->model.'-'.$permission)) |
|
| 231 | + {} else |
|
| 234 | 232 | { |
| 235 | 233 | |
| 236 | 234 | \ErrorHandler::noPermissions(); |
@@ -174,14 +174,12 @@ |
||
| 174 | 174 | if (strpos($rule, 'unique')) |
| 175 | 175 | { |
| 176 | 176 | $rule = substr($rule, 0, strpos($rule, 'unique') + 6); |
| 177 | - } |
|
| 178 | - elseif (strpos($rule, 'exists')) |
|
| 177 | + } elseif (strpos($rule, 'exists')) |
|
| 179 | 178 | { |
| 180 | 179 | $rule = substr($rule, 0, strpos($rule, 'exists') - 1); |
| 181 | 180 | } |
| 182 | 181 | } |
| 183 | - } |
|
| 184 | - else |
|
| 182 | + } else |
|
| 185 | 183 | { |
| 186 | 184 | $route['body'] = 'conditions'; |
| 187 | 185 | } |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | if ( ! $report) |
| 40 | 40 | { |
| 41 | 41 | \ErrorHandler::notFound('report'); |
| 42 | - } |
|
| 43 | - else if ( ! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
| 42 | + } else if ( ! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
| 44 | 43 | { |
| 45 | 44 | \ErrorHandler::noPermissions(); |
| 46 | 45 | } |