Skip to content

Commit

Permalink
sort shop items by name
Browse files Browse the repository at this point in the history
  • Loading branch information
ScuffedNewt committed Oct 9, 2023
1 parent 4080186 commit 1149bb7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Http/Controllers/Users/UserShopController.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ public function getItemSearch(Request $request) {
$items = $items->merge($category_items);
}

// sort shop items by name
$shopItems = $shopItems->sortBy(function ($item, $key) {
return $item->item->name;
});

return view('home.user_shops.search_items', [
'searched_items' => count($items) ? $items : null,
'items' => Item::released()->orderBy('name')->pluck('name', 'id'),
Expand Down

0 comments on commit 1149bb7

Please sign in to comment.