Completed
Pull Request — master (#259)
by
unknown
01:13
created
src/Engines/TNTSearchEngine.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         $index->indexBeginTransaction();
62 62
         $geoindex->indexBeginTransaction();
63
-        $models->each(function ($model) use ($index, $geoindex) {
63
+        $models->each(function($model) use ($index, $geoindex) {
64 64
             $array = $model->toSearchableArray();
65 65
 
66 66
             if (empty($array)) {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
             if ($model->getKey()) {
71 71
                 $index->update($model->getKey(), $array);
72
-                $geoindex->prepareAndExecuteStatement('DELETE FROM locations WHERE doc_id = :documentId;',[
72
+                $geoindex->prepareAndExecuteStatement('DELETE FROM locations WHERE doc_id = :documentId;', [
73 73
                     ['key' => ':documentId', 'value' => $model->getKey()]
74 74
                 ]);
75 75
             } else {
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     public function delete($models)
100 100
     {
101 101
         $this->initIndex($models->first());
102
-        $models->each(function ($model) {
102
+        $models->each(function($model) {
103 103
             $this->tnt->selectIndex("{$model->searchableAs()}.index");
104 104
             $index = $this->tnt->getIndex();
105 105
             $index->setPrimaryKey($model->getKeyName());
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
             $this->geotnt->selectIndex("{$model->searchableAs()}.geoindex");
109 109
             $geoindex = $this->geotnt->getIndex();
110
-            $geoindex->prepareAndExecuteStatement('DELETE FROM locations WHERE doc_id = :documentId;',[
110
+            $geoindex->prepareAndExecuteStatement('DELETE FROM locations WHERE doc_id = :documentId;', [
111 111
                 ['key' => ':documentId', 'value' => $model->getKey()]
112 112
             ]);
113 113
         });
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         }
241 241
 
242 242
         // sort models by tnt search result set
243
-        return collect($results['ids'])->map(function ($hit) use ($models) {
243
+        return collect($results['ids'])->map(function($hit) use ($models) {
244 244
             if (isset($models[$hit])) {
245 245
                 return $models[$hit];
246 246
             }
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 
338 338
         $discardIds = $builder->model->newQuery()
339 339
             ->select($qualifiedKeyName)
340
-            ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '. $builder->model->getConnection()->getTablePrefix() .'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName)
340
+            ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '.$builder->model->getConnection()->getTablePrefix().'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName)
341 341
             ->addBinding($sub->getQuery()->getBindings(), 'join')
342 342
             ->whereIn($qualifiedKeyName, $searchResults)
343 343
             ->whereNull($subQualifiedKeyName)
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
     private function applyWheres($builder)
409 409
     {
410 410
         // iterate over given where clauses
411
-        return collect($this->builder->wheres)->map(function ($value, $key) {
411
+        return collect($this->builder->wheres)->map(function($value, $key) {
412 412
             // for reduce function combine key and value into array
413 413
             return [$key, $value];
414
-        })->reduce(function ($builder, $where) {
414
+        })->reduce(function($builder, $where) {
415 415
             // separate key, value again
416 416
             list($key, $value) = $where;
417 417
             return $builder->where($key, $value);
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
     private function applyOrders($builder)
428 428
     {
429 429
         //iterate over given orderBy clauses - should be only one
430
-        return collect($this->builder->orders)->map(function ($value, $key) {
430
+        return collect($this->builder->orders)->map(function($value, $key) {
431 431
             // for reduce function combine key and value into array
432 432
             return [$value["column"], $value["direction"]];
433
-        })->reduce(function ($builder, $orderBy) {
433
+        })->reduce(function($builder, $orderBy) {
434 434
             // separate key, value again
435 435
             list($column, $direction) = $orderBy;
436 436
             return $builder->orderBy($column, $direction);
Please login to merge, or discard this patch.