@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | // make sure there is and id in the array - otherwise we will create duplicates all the time |
48 | 48 | if (array_key_exists('id', $searchableModel)) { |
49 | - $searchableModel['id'] = $model->getScoutKey(); |
|
49 | + $searchableModel[ 'id' ] = $model->getScoutKey(); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $document = $updateQuery->createDocument($searchableModel); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $updateQuery = $this->client->createUpdate(); |
75 | 75 | |
76 | - $ids = $models->map(function ($model) { |
|
76 | + $ids = $models->map(function($model) { |
|
77 | 77 | return $model->getScoutKey(); |
78 | 78 | }); |
79 | 79 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function paginate(Builder $builder, $perPage, $page) |
106 | 106 | { |
107 | - return $this->performSearch($builder, $perPage,$page - 1); |
|
107 | + return $this->performSearch($builder, $perPage, $page - 1); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function mapIds($results) |
117 | 117 | { |
118 | - $ids = array_map(function ($document) { |
|
118 | + $ids = array_map(function($document) { |
|
119 | 119 | return $document->id; |
120 | 120 | }, $results->getDocuments()); |
121 | 121 | |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | |
139 | 139 | $models = $model->getScoutModelsByIds( |
140 | 140 | $builder, collect($results->getDocuments())->pluck('id')->values()->all() |
141 | - )->keyBy(function ($model) { |
|
141 | + )->keyBy(function($model) { |
|
142 | 142 | return $model->getScoutKey(); |
143 | 143 | }); |
144 | 144 | |
145 | - return Collection::make($results->getDocuments())->map(function ($document) use ($models) { |
|
146 | - if (isset($models[$document['id']])) { |
|
147 | - return $models[$document['id']]; |
|
145 | + return Collection::make($results->getDocuments())->map(function($document) use ($models) { |
|
146 | + if (isset($models[ $document[ 'id' ] ])) { |
|
147 | + return $models[ $document[ 'id' ] ]; |
|
148 | 148 | } |
149 | 149 | })->filter()->values(); |
150 | 150 | } |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | { |
173 | 173 | $selectQuery = $this->client->createSelect(); |
174 | 174 | |
175 | - $conditions = (empty($builder->query)) ? [] : [$builder->query]; |
|
175 | + $conditions = (empty($builder->query)) ? [ ] : [ $builder->query ]; |
|
176 | 176 | $conditions = array_merge($conditions, $this->filters($builder)); |
177 | 177 | |
178 | 178 | $selectQuery->setQuery(implode(' ', $conditions)); |
179 | 179 | |
180 | - if(!is_null($perPage)) { |
|
180 | + if (!is_null($perPage)) { |
|
181 | 181 | $selectQuery->setStart($offset)->setRows($perPage); |
182 | 182 | } |
183 | 183 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | protected function filters(Builder $builder) |
196 | 196 | { |
197 | - return collect($builder->wheres)->map(function ($value, $key) { |
|
197 | + return collect($builder->wheres)->map(function($value, $key) { |
|
198 | 198 | return sprintf('%s:"%s"', $key, $value); |
199 | 199 | })->values()->all(); |
200 | 200 | } |