From aeb61c432c80314fca70254c5a87265840ecd6d5 Mon Sep 17 00:00:00 2001 From: Ernest Walzel Date: Thu, 14 Mar 2024 07:25:46 +0100 Subject: [PATCH] Fix authority ordering to support non-numeric IDs --- app/Http/Controllers/AuthorController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/AuthorController.php b/app/Http/Controllers/AuthorController.php index a6069afa3..55a48c556 100644 --- a/app/Http/Controllers/AuthorController.php +++ b/app/Http/Controllers/AuthorController.php @@ -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