Skip to content

Commit

Permalink
fix query multiple models with customised binding key (via attribute)
Browse files Browse the repository at this point in the history
  • Loading branch information
d8vjork committed Oct 11, 2023
1 parent da403c6 commit 8818012
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PropertiesMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected function getModelInstance(string $model, mixed $id, string $usingAttri

$baseQuery = $model::query()->when(
$usingAttribute,
fn (Builder $query) => $query->where($usingAttribute, $id),
fn (Builder $query) => is_iterable($id) ? $query->whereIn($usingAttribute, $id) : $query->where($usingAttribute, $id),
fn (Builder $query) => $query->whereKey($id)
);

Expand Down

0 comments on commit 8818012

Please sign in to comment.