@@ -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()); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $model->getQualifiedKeyName(), $keys |
234 | 234 | )->get()->keyBy($model->getKeyName()); |
235 | 235 | |
236 | - return $model->newCollection(collect($keys)->map(function ($hit) use ($models, $results) { |
|
236 | + return $model->newCollection(collect($keys)->map(function($hit) use ($models, $results) { |
|
237 | 237 | if (isset($models[$hit])) { |
238 | 238 | return $models[$hit]->setAttribute('__tntSearchScore__', $results['docScores'][$hit]); |
239 | 239 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | // sort models by tnt search result set |
275 | - return $model->newCollection($results['ids'])->map(function ($hit) use ($models) { |
|
275 | + return $model->newCollection($results['ids'])->map(function($hit) use ($models) { |
|
276 | 276 | if (isset($models[$hit])) { |
277 | 277 | return $models[$hit]; |
278 | 278 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | return; |
337 | 337 | } |
338 | 338 | |
339 | - if (!file_exists($this->tnt->config['storage'] . "/{$indexName}.index")) { |
|
339 | + if (!file_exists($this->tnt->config['storage']."/{$indexName}.index")) { |
|
340 | 340 | $indexer = $this->tnt->createIndex("$indexName.index"); |
341 | 341 | $indexer->setDatabaseHandle($model->getConnection()->getPdo()); |
342 | 342 | $indexer->setPrimaryKey($model->getKeyName()); |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | private function discardIdsFromResultSetByConstraints($builder, $searchResults) |
362 | 362 | { |
363 | 363 | $qualifiedKeyName = $builder->model->getQualifiedKeyName(); // tableName.id |
364 | - $subQualifiedKeyName = 'sub.' . $builder->model->getKeyName(); // sub.id |
|
364 | + $subQualifiedKeyName = 'sub.'.$builder->model->getKeyName(); // sub.id |
|
365 | 365 | |
366 | 366 | $sub = $this->getBuilder($builder->model)->whereIn( |
367 | 367 | $qualifiedKeyName, $searchResults |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | $discardIds = $builder->model->newQuery() |
371 | 371 | ->select($qualifiedKeyName) |
372 | - ->leftJoin(DB::raw('(' . $sub->getQuery()->toSql() . ') as ' . $builder->model->getConnection()->getTablePrefix() . 'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
372 | + ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '.$builder->model->getConnection()->getTablePrefix().'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
373 | 373 | ->addBinding($sub->getQuery()->getBindings(), 'join') |
374 | 374 | ->whereIn($qualifiedKeyName, $searchResults) |
375 | 375 | ->whereNull($subQualifiedKeyName) |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | private function applyWheres($builder) |
441 | 441 | { |
442 | 442 | // iterate over given where clauses |
443 | - return collect($this->builder->wheres)->map(function ($value, $key) { |
|
443 | + return collect($this->builder->wheres)->map(function($value, $key) { |
|
444 | 444 | // for reduce function combine key and value into array |
445 | 445 | return [$key, $value]; |
446 | - })->reduce(function ($builder, $where) { |
|
446 | + })->reduce(function($builder, $where) { |
|
447 | 447 | // separate key, value again |
448 | 448 | list($key, $value) = $where; |
449 | 449 | return $builder->where($key, $value); |
@@ -459,10 +459,10 @@ discard block |
||
459 | 459 | private function applyOrders($builder) |
460 | 460 | { |
461 | 461 | //iterate over given orderBy clauses - should be only one |
462 | - return collect($this->builder->orders)->map(function ($value, $key) { |
|
462 | + return collect($this->builder->orders)->map(function($value, $key) { |
|
463 | 463 | // for reduce function combine key and value into array |
464 | 464 | return [$value["column"], $value["direction"]]; |
465 | - })->reduce(function ($builder, $orderBy) { |
|
465 | + })->reduce(function($builder, $orderBy) { |
|
466 | 466 | // separate key, value again |
467 | 467 | list($column, $direction) = $orderBy; |
468 | 468 | return $builder->orderBy($column, $direction); |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | public function flush($model) |
479 | 479 | { |
480 | 480 | $indexName = $model->searchableAs(); |
481 | - $pathToIndex = $this->tnt->config['storage'] . "/{$indexName}.index"; |
|
481 | + $pathToIndex = $this->tnt->config['storage']."/{$indexName}.index"; |
|
482 | 482 | if (file_exists($pathToIndex)) { |
483 | 483 | unlink($pathToIndex); |
484 | 484 | } |