Completed
Pull Request — master (#285)
by
unknown
01:14
created
src/Engines/TNTSearchEngine.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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());
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $results['hits'] = $filtered->count();
121 121
 
122 122
         $filtered_array = $filtered->toArray();
123
-        if ($this->builder->orders[0]['direction']=="desc"){
123
+        if ($this->builder->orders[0]['direction'] == "desc") {
124 124
             rsort($filtered_array);
125 125
         }
126 126
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         }
211 211
 
212 212
         // sort models by tnt search result set
213
-        return $model->newCollection($results['ids'])->map(function ($hit) use ($models) {
213
+        return $model->newCollection($results['ids'])->map(function($hit) use ($models) {
214 214
             if (isset($models[$hit])) {
215 215
                 return $models[$hit];
216 216
             }
@@ -370,10 +370,10 @@  discard block
 block discarded – undo
370 370
     private function applyWheres($builder)
371 371
     {
372 372
         // iterate over given where clauses
373
-        return collect($this->builder->wheres)->map(function ($value, $key) {
373
+        return collect($this->builder->wheres)->map(function($value, $key) {
374 374
             // for reduce function combine key and value into array
375 375
             return [$key, $value];
376
-        })->reduce(function ($builder, $where) {
376
+        })->reduce(function($builder, $where) {
377 377
             // separate key, value again
378 378
             list($key, $value) = $where;
379 379
             return $builder->where($key, $value);
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
     private function applyOrders($builder)
390 390
     {
391 391
         //iterate over given orderBy clauses - should be only one
392
-        return collect($this->builder->orders)->map(function ($value, $key) {
392
+        return collect($this->builder->orders)->map(function($value, $key) {
393 393
             // for reduce function combine key and value into array
394 394
             return [$value["column"], $value["direction"]];
395
-        })->reduce(function ($builder, $orderBy) {
395
+        })->reduce(function($builder, $orderBy) {
396 396
             // separate key, value again
397 397
             list($column, $direction) = $orderBy;
398 398
             return $builder->orderBy($column, $direction);
Please login to merge, or discard this patch.