From dd9c9520fb053645ea2a63955d72321e4cef9954 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 13 Jun 2022 20:42:21 -0700 Subject: [PATCH] Correctly filter by category_id Signed-off-by: snipe --- app/Http/Controllers/Api/AssetModelsController.php | 4 ++++ resources/views/categories/view.blade.php | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/AssetModelsController.php b/app/Http/Controllers/Api/AssetModelsController.php index b788bc167f..5e9b3ad78d 100644 --- a/app/Http/Controllers/Api/AssetModelsController.php +++ b/app/Http/Controllers/Api/AssetModelsController.php @@ -70,6 +70,10 @@ class AssetModelsController extends Controller $assetmodels->onlyTrashed(); } + if ($request->filled('category_id')) { + $assetmodels = $assetmodels->where('models.category_id', '=', $request->input('category_id')); + } + if ($request->filled('search')) { $assetmodels->TextSearch($request->input('search')); } diff --git a/resources/views/categories/view.blade.php b/resources/views/categories/view.blade.php index cbc4d48d64..a37a87616f 100644 --- a/resources/views/categories/view.blade.php +++ b/resources/views/categories/view.blade.php @@ -129,11 +129,13 @@
+ @can('update', \App\Models\AssetModel::class) @if ($category->models->count() > 0) @if ($category->category_type=='asset') @include('partials.models-bulk-actions') @endif @endif + @endcan