Completed
Pull Request — master (#178)
by
unknown
02:53
created
src/TNTSearchScoutServiceProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -43,6 +43,9 @@  discard block
 block discarded – undo
43 43
         });
44 44
     }
45 45
 
46
+    /**
47
+     * @param TNTSearch $tnt
48
+     */
46 49
     protected function setFuzziness($tnt)
47 50
     {
48 51
         $tnt->fuzziness            = config('scout.tntsearch.fuzziness', $tnt->fuzziness);
@@ -51,6 +54,9 @@  discard block
 block discarded – undo
51 54
         $tnt->fuzzy_max_expansions = config('scout.tntsearch.fuzzy.max_expansions', $tnt->fuzzy_max_expansions);
52 55
     }
53 56
 
57
+    /**
58
+     * @param TNTSearch $tnt
59
+     */
54 60
     protected function setAsYouType($tnt)
55 61
     {
56 62
         $tnt->asYouType = config('scout.tntsearch.asYouType', $tnt->asYouType);
Please login to merge, or discard this patch.
src/Engines/TNTSearchEngine.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $index->setPrimaryKey($models->first()->getKeyName());
46 46
 
47 47
         $index->indexBeginTransaction();
48
-        $models->each(function ($model) use ($index) {
48
+        $models->each(function($model) use ($index) {
49 49
             $array = $model->toSearchableArray();
50 50
 
51 51
             if (empty($array)) {
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public function delete($models)
72 72
     {
73 73
         $this->initIndex($models->first());
74
-        $models->each(function ($model) {
74
+        $models->each(function($model) {
75 75
             $this->tnt->selectIndex("{$model->searchableAs()}.index");
76 76
             $index = $this->tnt->getIndex();
77 77
             $index->setPrimaryKey($model->getKeyName());
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 
115 115
         $searchResults = $results['ids'];
116 116
 
117
-        $qualifiedKeyName = $builder->model->getQualifiedKeyName();  // tableName.id
118
-        $subQualifiedKeyName = 'sub.' . $builder->model->getKeyName(); // sub.id
117
+        $qualifiedKeyName = $builder->model->getQualifiedKeyName(); // tableName.id
118
+        $subQualifiedKeyName = 'sub.'.$builder->model->getKeyName(); // sub.id
119 119
     
120 120
         $sub = $this->getBuilder($builder->model)->whereIn(
121 121
             $qualifiedKeyName, $searchResults
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     protected function filters(Builder $builder)
208 208
     {
209
-        return collect($builder->wheres)->map(function ($value, $key) {
209
+        return collect($builder->wheres)->map(function($value, $key) {
210 210
             return $key.'='.$value;
211 211
         })->values()->all();
212 212
     }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
         $builder = $this->getBuilder($model);
231 231
         
232
-        if($this->builder->queryCallback){
232
+        if ($this->builder->queryCallback) {
233 233
             call_user_func($this->builder->queryCallback, $builder);
234 234
         }
235 235
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
             $model->getQualifiedKeyName(), $keys
238 238
         )->get()->keyBy($model->getKeyName());
239 239
 
240
-        return collect($results['ids'])->map(function ($hit) use ($models) {
240
+        return collect($results['ids'])->map(function($hit) use ($models) {
241 241
             if (isset($models[$hit])) {
242 242
                 return $models[$hit];
243 243
             }
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
         $builder = isset($this->builder->constraints) ? $this->builder->constraints : $model->newQuery();
259 259
 
260 260
         // iterate over given where clauses
261
-        return collect($this->builder->wheres)->map(function ($value, $key) {
261
+        return collect($this->builder->wheres)->map(function($value, $key) {
262 262
             // for reduce function combine key and value into array
263 263
             return [$key, $value];
264
-        })->reduce(function ($builder, $where) {
264
+        })->reduce(function($builder, $where) {
265 265
             // separate key, value again
266 266
             list($key, $value) = $where;
267 267
             return $builder->where($key, $value);
Please login to merge, or discard this patch.