@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $model = $this->model->onlyTrashed()->find($id); |
| 249 | 249 | |
| 250 | 250 | if (!$model) { |
| 251 | - Errors::notFound(class_basename($this->model) . ' with id : ' . $id); |
|
| 251 | + Errors::notFound(class_basename($this->model).' with id : '.$id); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | $model->restore(); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $model = Arr::has($data, 'id') ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass; |
| 269 | 269 | |
| 270 | 270 | if (!$model) { |
| 271 | - Errors::notFound(class_basename($modelClass) . ' with id : ' . $data['id']); |
|
| 271 | + Errors::notFound(class_basename($modelClass).' with id : '.$data['id']); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | foreach ($data as $key => $value) { |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | if (!$relatedModel) { |
| 334 | - Errors::notFound(class_basename($relationBaseModel) . ' with id : ' . $relatedModelData['id']); |
|
| 334 | + Errors::notFound(class_basename($relationBaseModel).' with id : '.$relatedModelData['id']); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | if (is_array($relatedModelData)) { |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | if ($key == 'and') { |
| 403 | 403 | $conditions = $this->constructConditions($value, $model); |
| 404 | - $conditionString .= str_replace('{op}', 'and', $conditions['conditionString']) . ' {op} '; |
|
| 404 | + $conditionString .= str_replace('{op}', 'and', $conditions['conditionString']).' {op} '; |
|
| 405 | 405 | $conditionValues = array_merge($conditionValues, $conditions['conditionValues']); |
| 406 | 406 | } elseif ($key == 'or') { |
| 407 | 407 | $conditions = $this->constructConditions($value, $model); |
| 408 | - $conditionString .= str_replace('{op}', 'or', $conditions['conditionString']) . ' {op} '; |
|
| 408 | + $conditionString .= str_replace('{op}', 'or', $conditions['conditionString']).' {op} '; |
|
| 409 | 409 | $conditionValues = array_merge($conditionValues, $conditions['conditionValues']); |
| 410 | 410 | } else { |
| 411 | 411 | if (is_array($value)) { |
@@ -421,38 +421,38 @@ discard block |
||
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | if (strtolower($operator) == 'between') { |
| 424 | - $conditionString .= $key . ' >= ? and '; |
|
| 424 | + $conditionString .= $key.' >= ? and '; |
|
| 425 | 425 | $conditionValues[] = $value1; |
| 426 | 426 | |
| 427 | - $conditionString .= $key . ' <= ? {op} '; |
|
| 427 | + $conditionString .= $key.' <= ? {op} '; |
|
| 428 | 428 | $conditionValues[] = $value2; |
| 429 | 429 | } elseif (strtolower($operator) == 'in') { |
| 430 | 430 | $conditionValues = array_merge($conditionValues, $value); |
| 431 | 431 | $inBindingsString = rtrim(str_repeat('?,', count($value)), ','); |
| 432 | - $conditionString .= $key . ' in (' . rtrim($inBindingsString, ',') . ') {op} '; |
|
| 432 | + $conditionString .= $key.' in ('.rtrim($inBindingsString, ',').') {op} '; |
|
| 433 | 433 | } elseif (strtolower($operator) == 'null') { |
| 434 | - $conditionString .= $key . ' is null {op} '; |
|
| 434 | + $conditionString .= $key.' is null {op} '; |
|
| 435 | 435 | } elseif (strtolower($operator) == 'not null') { |
| 436 | - $conditionString .= $key . ' is not null {op} '; |
|
| 436 | + $conditionString .= $key.' is not null {op} '; |
|
| 437 | 437 | } elseif (strtolower($operator) == 'has') { |
| 438 | 438 | $sql = $model->withTrashed()->withoutGlobalScopes()->has($key)->toSql(); |
| 439 | 439 | $bindings = $model->withTrashed()->withoutGlobalScopes()->has($key)->getBindings(); |
| 440 | 440 | if ($value) { |
| 441 | 441 | $conditions = $this->constructConditions($value, $model->$key()->getRelated()); |
| 442 | - $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1) . ' and ' . $conditions['conditionString'] . ') {op} '; |
|
| 442 | + $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1).' and '.$conditions['conditionString'].') {op} '; |
|
| 443 | 443 | $conditionValues = array_merge($conditionValues, $bindings); |
| 444 | 444 | $conditionValues = array_merge($conditionValues, $conditions['conditionValues']); |
| 445 | 445 | } else { |
| 446 | - $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1) . ') {op} '; |
|
| 446 | + $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1).') {op} '; |
|
| 447 | 447 | $conditionValues = array_merge($conditionValues, $bindings); |
| 448 | 448 | } |
| 449 | 449 | } else { |
| 450 | - $conditionString .= $key . ' ' . $operator . ' ? {op} '; |
|
| 450 | + $conditionString .= $key.' '.$operator.' ? {op} '; |
|
| 451 | 451 | $conditionValues[] = $value; |
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | } |
| 455 | - $conditionString = '(' . rtrim($conditionString, '{op} ') . ')'; |
|
| 455 | + $conditionString = '('.rtrim($conditionString, '{op} ').')'; |
|
| 456 | 456 | return ['conditionString' => $conditionString, 'conditionValues' => $conditionValues]; |
| 457 | 457 | } |
| 458 | 458 | |
@@ -469,9 +469,9 @@ discard block |
||
| 469 | 469 | $path = explode('->', $value); |
| 470 | 470 | $field = array_shift($path); |
| 471 | 471 | $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function ($part) { |
| 472 | - return '"' . $part . '"'; |
|
| 472 | + return '"'.$part.'"'; |
|
| 473 | 473 | })->implode('.')); |
| 474 | 474 | |
| 475 | - return $removeLast === false ? $result : $result . ')'; |
|
| 475 | + return $removeLast === false ? $result : $result.')'; |
|
| 476 | 476 | } |
| 477 | 477 | } |