@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $index->indexBeginTransaction(); |
| 66 | - $models->each(function ($model) use ($index, $geoindex) { |
|
| 66 | + $models->each(function($model) use ($index, $geoindex) { |
|
| 67 | 67 | $array = $model->toSearchableArray(); |
| 68 | 68 | |
| 69 | 69 | if (empty($array)) { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | if ($model->getKey()) { |
| 74 | 74 | $index->update($model->getKey(), $array); |
| 75 | 75 | if ($geoindex) { |
| 76 | - $geoindex->prepareAndExecuteStatement('DELETE FROM locations WHERE doc_id = :documentId;',[ |
|
| 76 | + $geoindex->prepareAndExecuteStatement('DELETE FROM locations WHERE doc_id = :documentId;', [ |
|
| 77 | 77 | ['key' => ':documentId', 'value' => $model->getKey()] |
| 78 | 78 | ]); |
| 79 | 79 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | public function delete($models) |
| 107 | 107 | { |
| 108 | 108 | $this->initIndex($models->first()); |
| 109 | - $models->each(function ($model) { |
|
| 109 | + $models->each(function($model) { |
|
| 110 | 110 | $this->tnt->selectIndex("{$model->searchableAs()}.index"); |
| 111 | 111 | $index = $this->tnt->getIndex(); |
| 112 | 112 | $index->setPrimaryKey($model->getKeyName()); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | if ($this->geotnt) { |
| 116 | 116 | $this->geotnt->selectIndex("{$model->searchableAs()}.geoindex"); |
| 117 | 117 | $geoindex = $this->geotnt->getIndex(); |
| 118 | - $geoindex->prepareAndExecuteStatement('DELETE FROM locations WHERE doc_id = :documentId;',[ |
|
| 118 | + $geoindex->prepareAndExecuteStatement('DELETE FROM locations WHERE doc_id = :documentId;', [ |
|
| 119 | 119 | ['key' => ':documentId', 'value' => $model->getKey()] |
| 120 | 120 | ]); |
| 121 | 121 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // sort models by tnt search result set |
| 254 | - return collect($results['ids'])->map(function ($hit) use ($models) { |
|
| 254 | + return collect($results['ids'])->map(function($hit) use ($models) { |
|
| 255 | 255 | if (isset($models[$hit])) { |
| 256 | 256 | return $models[$hit]; |
| 257 | 257 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | $discardIds = $builder->model->newQuery() |
| 354 | 354 | ->select($qualifiedKeyName) |
| 355 | - ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '. $builder->model->getConnection()->getTablePrefix() .'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
| 355 | + ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '.$builder->model->getConnection()->getTablePrefix().'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
| 356 | 356 | ->addBinding($sub->getQuery()->getBindings(), 'join') |
| 357 | 357 | ->whereIn($qualifiedKeyName, $searchResults) |
| 358 | 358 | ->whereNull($subQualifiedKeyName) |
@@ -423,10 +423,10 @@ discard block |
||
| 423 | 423 | private function applyWheres($builder) |
| 424 | 424 | { |
| 425 | 425 | // iterate over given where clauses |
| 426 | - return collect($this->builder->wheres)->map(function ($value, $key) { |
|
| 426 | + return collect($this->builder->wheres)->map(function($value, $key) { |
|
| 427 | 427 | // for reduce function combine key and value into array |
| 428 | 428 | return [$key, $value]; |
| 429 | - })->reduce(function ($builder, $where) { |
|
| 429 | + })->reduce(function($builder, $where) { |
|
| 430 | 430 | // separate key, value again |
| 431 | 431 | list($key, $value) = $where; |
| 432 | 432 | return $builder->where($key, $value); |
@@ -442,10 +442,10 @@ discard block |
||
| 442 | 442 | private function applyOrders($builder) |
| 443 | 443 | { |
| 444 | 444 | //iterate over given orderBy clauses - should be only one |
| 445 | - return collect($this->builder->orders)->map(function ($value, $key) { |
|
| 445 | + return collect($this->builder->orders)->map(function($value, $key) { |
|
| 446 | 446 | // for reduce function combine key and value into array |
| 447 | 447 | return [$value["column"], $value["direction"]]; |
| 448 | - })->reduce(function ($builder, $orderBy) { |
|
| 448 | + })->reduce(function($builder, $orderBy) { |
|
| 449 | 449 | // separate key, value again |
| 450 | 450 | list($column, $direction) = $orderBy; |
| 451 | 451 | return $builder->orderBy($column, $direction); |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | unlink($pathToIndex); |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - if ($this->geotnt){ |
|
| 469 | + if ($this->geotnt) { |
|
| 470 | 470 | $pathToGeoIndex = $this->geotnt->config['storage']."/{$indexName}.geoindex"; |
| 471 | 471 | if (file_exists($pathToGeoIndex)) { |
| 472 | 472 | unlink($pathToGeoIndex); |