@@ -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'); |
@@ -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()); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | // sort models by tnt search result set |
| 208 | - return $model->newCollection($results['ids'])->map(function ($hit) use ($models) { |
|
| 208 | + return $model->newCollection($results['ids'])->map(function($hit) use ($models) { |
|
| 209 | 209 | if (isset($models[$hit])) { |
| 210 | 210 | return $models[$hit]; |
| 211 | 211 | } |
@@ -365,10 +365,10 @@ discard block |
||
| 365 | 365 | private function applyWheres($builder) |
| 366 | 366 | { |
| 367 | 367 | // iterate over given where clauses |
| 368 | - return collect($this->builder->wheres)->map(function ($value, $key) { |
|
| 368 | + return collect($this->builder->wheres)->map(function($value, $key) { |
|
| 369 | 369 | // for reduce function combine key and value into array |
| 370 | 370 | return [$key, $value]; |
| 371 | - })->reduce(function ($builder, $where) { |
|
| 371 | + })->reduce(function($builder, $where) { |
|
| 372 | 372 | // separate key, value again |
| 373 | 373 | list($key, $value) = $where; |
| 374 | 374 | return $builder->where($key, $value); |
@@ -384,10 +384,10 @@ discard block |
||
| 384 | 384 | private function applyOrders($builder) |
| 385 | 385 | { |
| 386 | 386 | //iterate over given orderBy clauses - should be only one |
| 387 | - return collect($this->builder->orders)->map(function ($value, $key) { |
|
| 387 | + return collect($this->builder->orders)->map(function($value, $key) { |
|
| 388 | 388 | // for reduce function combine key and value into array |
| 389 | 389 | return [$value["column"], $value["direction"]]; |
| 390 | - })->reduce(function ($builder, $orderBy) { |
|
| 390 | + })->reduce(function($builder, $orderBy) { |
|
| 391 | 391 | // separate key, value again |
| 392 | 392 | list($column, $direction) = $orderBy; |
| 393 | 393 | return $builder->orderBy($column, $direction); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $indexedColumns = $rowsTotal ? implode(",", array_keys($model->first()->toSearchableArray())) : ''; |
| 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</>"; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | private function getSearchableModels() |
| 128 | 128 | { |
| 129 | - $searchableModels = (array)$this->argument('model'); |
|
| 129 | + $searchableModels = (array) $this->argument('model'); |
|
| 130 | 130 | if (empty($searchableModels)) { |
| 131 | 131 | $searchableModels = $this->getSearchableModelsFromClasses(); |
| 132 | 132 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | private function isSearchableModel($trait) |
| 142 | 142 | { |
| 143 | - return function ($className) use ($trait) { |
|
| 143 | + return function($className) use ($trait) { |
|
| 144 | 144 | $traits = class_uses($className); |
| 145 | 145 | |
| 146 | 146 | return isset($traits[$trait]); |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | $tnt->loadConfig($config); |
| 44 | 44 | $tnt->setDatabaseHandle($db->getPdo()); |
| 45 | 45 | |
| 46 | - if(!$model->count()) { |
|
| 46 | + if (!$model->count()) { |
|
| 47 | 47 | $this->info('Nothing to import.'); |
| 48 | 48 | exit(0); |
| 49 | 49 | } |