Skip to content

Commit

Permalink
fix: Fix outputting duplicate manufacturers
Browse files Browse the repository at this point in the history
Fixes #97
  • Loading branch information
octfx committed Dec 29, 2023
1 parent 9c26257 commit d91a704
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/Http/Controllers/Api/V2/SC/ManufacturerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class ManufacturerController extends AbstractApiV2Controller
public function index(Request $request): AnonymousResourceCollection
{
$query = QueryBuilder::for(Manufacturer::class, $request)
->select(['name'])
->selectRaw('MAX(`code`) as code')
->groupBy('name')
->orderBy('name')
->paginate($this->limit)
->appends(request()->query());

Expand Down

0 comments on commit d91a704

Please sign in to comment.