Skip to content

Commit

Permalink
Fix authority ordering to support non-numeric IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
eronisko committed Mar 14, 2024
1 parent f404d5a commit aeb61c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Controllers/AuthorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function getIndexData()
$authorities = Authority::query()
->whereIn('id', $authorityIds)
->with(['translations'])
->orderByRaw('FIELD(id, ' . $authorityIds->join(',') . ')')
->orderByRaw('FIELD(id, ' . $authorityIds->map(fn($id) => "'$id'")->join(',') . ')')
->get()
->map(function (Authority $authority, $index) use ($itemCounts) {
// Use indexed items_count to speed things up
Expand Down

0 comments on commit aeb61c4

Please sign in to comment.