Skip to content

Commit

Permalink
added grants to items search
Browse files Browse the repository at this point in the history
  • Loading branch information
Timtendo12 committed Feb 1, 2024
1 parent 55cac53 commit f5359f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/Http/Controllers/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use App\Http\Requests\ItemRequest;
use App\Http\Requests\SearchItemRequest;
use App\Models\Author;
use App\Models\Grant;
use App\Models\Item;
use App\Models\ItemImage;
use App\Models\LibraryPass;
Expand Down Expand Up @@ -150,6 +151,13 @@ public function search(SearchItemRequest $request) {
}
}

foreach ($items as $item) {
$item->grants = Grant::where('item_id', $item->id)
->where('modified_kind', '!=', ModifiedEnum::deleted)
->where('return_date', null)
->get();
}

return $this->CommonResponse(
ResponseStatus::success,
'Search results',
Expand Down

0 comments on commit f5359f3

Please sign in to comment.