@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function boot() |
17 | 17 | { |
18 | - $this->app[EngineManager::class]->extend('tntsearch', function ($app) { |
|
18 | + $this->app[EngineManager::class]->extend('tntsearch', function($app) { |
|
19 | 19 | $tnt = new TNTSearch(); |
20 | 20 | |
21 | 21 | $driver = config('database.default'); |
@@ -5,9 +5,7 @@ |
||
5 | 5 | use Illuminate\Console\Command; |
6 | 6 | use Illuminate\Contracts\Events\Dispatcher; |
7 | 7 | use TeamTNT\TNTSearch\Exceptions\IndexNotFoundException; |
8 | -use TeamTNT\TNTSearch\Indexer\TNTIndexer; |
|
9 | 8 | use TeamTNT\TNTSearch\TNTSearch; |
10 | -use Illuminate\Support\Facades\Schema; |
|
11 | 9 | use Symfony\Component\Finder\Finder; |
12 | 10 | |
13 | 11 | class StatusCommand extends Command |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $rowsTotal = $model->count(); |
69 | 69 | $recordsDifference = $rowsTotal - $rowsIndexed; |
70 | 70 | |
71 | - if($recordsDifference == 0) { |
|
71 | + if ($recordsDifference == 0) { |
|
72 | 72 | $recordsDifference = '<fg=green>Synchronized</>'; |
73 | 73 | } else { |
74 | 74 | $recordsDifference = "<fg=red>$recordsDifference</>"; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | private function getSearchableModels() |
122 | 122 | { |
123 | - $searchableModels = (array)$this->argument('model'); |
|
123 | + $searchableModels = (array) $this->argument('model'); |
|
124 | 124 | if (empty($searchableModels)) { |
125 | 125 | $searchableModels = $this->getSearchableModelsFromClasses(); |
126 | 126 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | private function isSearchableModel($trait) |
136 | 136 | { |
137 | - return function ($className) use ($trait) { |
|
137 | + return function($className) use ($trait) { |
|
138 | 138 | $traits = class_uses($className); |
139 | 139 | |
140 | 140 | return isset($traits[$trait]); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $index->setPrimaryKey($models->first()->getKeyName()); |
49 | 49 | |
50 | 50 | $index->indexBeginTransaction(); |
51 | - $models->each(function ($model) use ($index) { |
|
51 | + $models->each(function($model) use ($index) { |
|
52 | 52 | $array = $model->toSearchableArray(); |
53 | 53 | |
54 | 54 | if (empty($array)) { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function delete($models) |
75 | 75 | { |
76 | 76 | $this->initIndex($models->first()); |
77 | - $models->each(function ($model) { |
|
77 | + $models->each(function($model) { |
|
78 | 78 | $this->tnt->selectIndex("{$model->searchableAs()}.index"); |
79 | 79 | $index = $this->tnt->getIndex(); |
80 | 80 | $index->setPrimaryKey($model->getKeyName()); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | return $results; |
126 | 126 | } |
127 | 127 | |
128 | - if ($this->builder->orders[0]['direction']==="desc"){ |
|
128 | + if ($this->builder->orders[0]['direction'] === "desc") { |
|
129 | 129 | rsort($chunks); |
130 | 130 | } |
131 | 131 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | // sort models by tnt search result set |
212 | - return $model->newCollection($results['ids'])->map(function ($hit) use ($models) { |
|
212 | + return $model->newCollection($results['ids'])->map(function($hit) use ($models) { |
|
213 | 213 | if (isset($models[$hit])) { |
214 | 214 | return $models[$hit]; |
215 | 215 | } |
@@ -369,10 +369,10 @@ discard block |
||
369 | 369 | private function applyWheres($builder) |
370 | 370 | { |
371 | 371 | // iterate over given where clauses |
372 | - return collect($this->builder->wheres)->map(function ($value, $key) { |
|
372 | + return collect($this->builder->wheres)->map(function($value, $key) { |
|
373 | 373 | // for reduce function combine key and value into array |
374 | 374 | return [$key, $value]; |
375 | - })->reduce(function ($builder, $where) { |
|
375 | + })->reduce(function($builder, $where) { |
|
376 | 376 | // separate key, value again |
377 | 377 | list($key, $value) = $where; |
378 | 378 | return $builder->where($key, $value); |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | private function applyOrders($builder) |
389 | 389 | { |
390 | 390 | //iterate over given orderBy clauses - should be only one |
391 | - return collect($this->builder->orders)->map(function ($value, $key) { |
|
391 | + return collect($this->builder->orders)->map(function($value, $key) { |
|
392 | 392 | // for reduce function combine key and value into array |
393 | 393 | return [$value["column"], $value["direction"]]; |
394 | - })->reduce(function ($builder, $orderBy) { |
|
394 | + })->reduce(function($builder, $orderBy) { |
|
395 | 395 | // separate key, value again |
396 | 396 | list($column, $direction) = $orderBy; |
397 | 397 | return $builder->orderBy($column, $direction); |