@@ -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 | - $offset = ($page-1) * $perPage; |
|
| 107 | + $offset = ($page - 1) * $perPage; |
|
| 108 | 108 | |
| 109 | 109 | return $this->performSearch($builder, $perPage, $offset); |
| 110 | 110 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function mapIds($results) |
| 119 | 119 | { |
| 120 | - $ids = array_map(function ($document) { |
|
| 120 | + $ids = array_map(function($document) { |
|
| 121 | 121 | return $document->id; |
| 122 | 122 | }, $results->getDocuments()); |
| 123 | 123 | |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $models = $model->getScoutModelsByIds( |
| 142 | 142 | $builder, collect($results->getDocuments())->pluck('id')->values()->all() |
| 143 | - )->keyBy(function ($model) { |
|
| 143 | + )->keyBy(function($model) { |
|
| 144 | 144 | return $model->getScoutKey(); |
| 145 | 145 | }); |
| 146 | 146 | |
| 147 | - return Collection::make($results->getDocuments())->map(function ($document) use ($models) { |
|
| 148 | - if (isset($models[$document['id']])) { |
|
| 149 | - return $models[$document['id']]; |
|
| 147 | + return Collection::make($results->getDocuments())->map(function($document) use ($models) { |
|
| 148 | + if (isset($models[ $document[ 'id' ] ])) { |
|
| 149 | + return $models[ $document[ 'id' ] ]; |
|
| 150 | 150 | } |
| 151 | 151 | })->filter()->values(); |
| 152 | 152 | } |
@@ -174,12 +174,12 @@ discard block |
||
| 174 | 174 | { |
| 175 | 175 | $selectQuery = $this->client->createSelect(); |
| 176 | 176 | |
| 177 | - $conditions = (empty($builder->query)) ? [] : [$builder->query]; |
|
| 177 | + $conditions = (empty($builder->query)) ? [ ] : [ $builder->query ]; |
|
| 178 | 178 | $conditions = array_merge($conditions, $this->filters($builder)); |
| 179 | 179 | |
| 180 | 180 | $selectQuery->setQuery(implode(' ', $conditions)); |
| 181 | 181 | |
| 182 | - if(!is_null($perPage)) { |
|
| 182 | + if (!is_null($perPage)) { |
|
| 183 | 183 | $selectQuery->setStart($offset)->setRows($perPage); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | protected function filters(Builder $builder) |
| 198 | 198 | { |
| 199 | - return collect($builder->wheres)->map(function ($value, $key) { |
|
| 199 | + return collect($builder->wheres)->map(function($value, $key) { |
|
| 200 | 200 | return sprintf('%s:"%s"', $key, $value); |
| 201 | 201 | })->values()->all(); |
| 202 | 202 | } |