Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.

Commit 006d4bd

Browse files
committed
The engine mapIds method must return Collection object
1 parent 1184fd6 commit 006d4bd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/ElasticEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function searchRaw(Model $model, $query)
262262
*/
263263
public function mapIds($results)
264264
{
265-
return array_pluck($results['hits']['hits'], '_id');
265+
return collect($results['hits']['hits'])->pluck('_id');
266266
}
267267

268268
/**
@@ -284,7 +284,7 @@ public function map($results, $model)
284284
$columns[] = $primaryKey;
285285
}
286286

287-
$ids = $this->mapIds($results);
287+
$ids = $this->mapIds($results)->all();
288288

289289
$builder = $model->usesSoftDelete() ? $model->withTrashed() : $model->newQuery();
290290

tests/ElasticEngineTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function testMapIds()
300300

301301
$this->assertEquals(
302302
[1, 2],
303-
$this->engine->mapIds($results)
303+
$this->engine->mapIds($results)->all()
304304
);
305305
}
306306

0 commit comments

Comments
 (0)