Skip to content

Commit

Permalink
Merge pull request #81 from Roywcm/master
Browse files Browse the repository at this point in the history
Update SoftDelete trait name
  • Loading branch information
pterk authored Jan 22, 2020
2 parents 2756a00 + aefd2f2 commit d81ea09
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/GetStream/StreamLaravel/Enrich.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ public function fromDb($model, $ids, $with = [])
$results = [];
$pkName = (new $model())->getKeyName();
$query = $model::with($with)->whereIn($pkName, $ids);
if (in_array('Illuminate\Database\Eloquent\SoftDeletingTrait', class_uses(get_class($model))) && $this->withTrashed) // previous withTrash method deprecated in Laravel 4.2
$softDeleteTraits = [
'Illuminate\Database\Eloquent\SoftDeletes',
'Illuminate\Database\Eloquent\SoftDeletingTrait'
];

if ((bool)array_intersect($softDeleteTraits, class_uses(get_class($model))) && $this->withTrashed) // previous withTrash method deprecated in Laravel 4.2
$query = $query->withTrashed();
$objects = $query->get();
foreach ($objects as $object) {
Expand Down

0 comments on commit d81ea09

Please sign in to comment.