diff --git a/src/app/Http/Controllers/ItemController.php b/src/app/Http/Controllers/ItemController.php index 6a7d4ce..7c1a5aa 100644 --- a/src/app/Http/Controllers/ItemController.php +++ b/src/app/Http/Controllers/ItemController.php @@ -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; @@ -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',