Skip to content

Commit

Permalink
Fix soft delete results (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Hoff authored and olsgreen committed Sep 9, 2019
1 parent 3886921 commit ebeba37
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/DatabaseEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,16 @@ public function map(Builder $builder, $results, $model)

$keys = $this->mapIds($results);

$models = $model->whereIn(
$query = $model->whereIn(
$model->getQualifiedKeyName(),
$keys
)->get()->keyBy($model->getKeyName());
);

if ($this->usesSoftDelete($model)) {
$query = $query->withTrashed();
}

$models = $query->get()->keyBy($model->getKeyName());

return Collection::make($results['results'])
->map(function ($record) use ($model, $models) {
Expand Down

0 comments on commit ebeba37

Please sign in to comment.