@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $index = $this->tnt->getIndex(); |
58 | 58 | $index->setPrimaryKey($models->first()->getKeyName()); |
59 | 59 | |
60 | - $models->each(function ($model) use ($index) { |
|
60 | + $models->each(function($model) use ($index) { |
|
61 | 61 | $array = $model->toSearchableArray(); |
62 | 62 | |
63 | 63 | if (empty($array)) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public function delete($models) |
83 | 83 | { |
84 | 84 | $this->initIndex($models->first()); |
85 | - $models->each(function ($model) { |
|
85 | + $models->each(function($model) { |
|
86 | 86 | $this->tnt->selectIndex("{$model->searchableAs()}.index"); |
87 | 87 | $index = $this->tnt->getIndex(); |
88 | 88 | $index->setPrimaryKey($model->getKeyName()); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | // sort models by tnt search result set |
219 | - return $model->newCollection(collect($results['ids'])->map(function ($hit) use ($models, $results) { |
|
219 | + return $model->newCollection(collect($results['ids'])->map(function($hit) use ($models, $results) { |
|
220 | 220 | if (isset($models[$hit])) { |
221 | 221 | if (isset($this->tnt->config['searchBoolean']) ? $this->tnt->config['searchBoolean'] : false) { |
222 | 222 | return $models[$hit]; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | // sort models by tnt search result set |
262 | - return $model->newCollection($results['ids'])->map(function ($hit) use ($models) { |
|
262 | + return $model->newCollection($results['ids'])->map(function($hit) use ($models) { |
|
263 | 263 | if (isset($models[$hit])) { |
264 | 264 | return $models[$hit]; |
265 | 265 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | return; |
324 | 324 | } |
325 | 325 | |
326 | - if (!file_exists($this->tnt->config['storage'] . "/{$indexName}.index")) { |
|
326 | + if (!file_exists($this->tnt->config['storage']."/{$indexName}.index")) { |
|
327 | 327 | $indexer = $this->tnt->createIndex("$indexName.index"); |
328 | 328 | $indexer->setDatabaseHandle($model->getConnection()->getPdo()); |
329 | 329 | $indexer->setPrimaryKey($model->getKeyName()); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | private function discardIdsFromResultSetByConstraints($builder, $searchResults) |
349 | 349 | { |
350 | 350 | $qualifiedKeyName = $builder->model->getQualifiedKeyName(); // tableName.id |
351 | - $subQualifiedKeyName = 'sub.' . $builder->model->getKeyName(); // sub.id |
|
351 | + $subQualifiedKeyName = 'sub.'.$builder->model->getKeyName(); // sub.id |
|
352 | 352 | |
353 | 353 | $sub = $this->getBuilder($builder->model)->whereIn( |
354 | 354 | $qualifiedKeyName, $searchResults |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | |
357 | 357 | $discardIds = $builder->model->newQuery() |
358 | 358 | ->select($qualifiedKeyName) |
359 | - ->leftJoin(DB::raw('(' . $sub->getQuery()->toSql() . ') as ' . $builder->model->getConnection()->getTablePrefix() . 'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
359 | + ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '.$builder->model->getConnection()->getTablePrefix().'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
360 | 360 | ->addBinding($sub->getQuery()->getBindings(), 'join') |
361 | 361 | ->whereIn($qualifiedKeyName, $searchResults) |
362 | 362 | ->whereNull($subQualifiedKeyName) |
@@ -427,10 +427,10 @@ discard block |
||
427 | 427 | private function applyWheres($builder) |
428 | 428 | { |
429 | 429 | // iterate over given where clauses |
430 | - return collect($this->builder->wheres)->map(function ($value, $key) { |
|
430 | + return collect($this->builder->wheres)->map(function($value, $key) { |
|
431 | 431 | // for reduce function combine key and value into array |
432 | 432 | return [$key, $value]; |
433 | - })->reduce(function ($builder, $where) { |
|
433 | + })->reduce(function($builder, $where) { |
|
434 | 434 | // separate key, value again |
435 | 435 | list($key, $value) = $where; |
436 | 436 | return $builder->where($key, $value); |
@@ -446,10 +446,10 @@ discard block |
||
446 | 446 | private function applyOrders($builder) |
447 | 447 | { |
448 | 448 | //iterate over given orderBy clauses - should be only one |
449 | - return collect($this->builder->orders)->map(function ($value, $key) { |
|
449 | + return collect($this->builder->orders)->map(function($value, $key) { |
|
450 | 450 | // for reduce function combine key and value into array |
451 | 451 | return [$value["column"], $value["direction"]]; |
452 | - })->reduce(function ($builder, $orderBy) { |
|
452 | + })->reduce(function($builder, $orderBy) { |
|
453 | 453 | // separate key, value again |
454 | 454 | list($column, $direction) = $orderBy; |
455 | 455 | return $builder->orderBy($column, $direction); |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | public function flush($model) |
466 | 466 | { |
467 | 467 | $indexName = $model->searchableAs(); |
468 | - $pathToIndex = $this->tnt->config['storage'] . "/{$indexName}.index"; |
|
468 | + $pathToIndex = $this->tnt->config['storage']."/{$indexName}.index"; |
|
469 | 469 | if (file_exists($pathToIndex)) { |
470 | 470 | unlink($pathToIndex); |
471 | 471 | } |