Correctly filter by category_id

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-06-13 20:42:21 -07:00
parent aec033d8d2
commit dd9c9520fb
2 changed files with 7 additions and 1 deletions

View file

@ -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'));
}

View file

@ -129,11 +129,13 @@
<div class="row">
<div class="col-md-12">
@can('update', \App\Models\AssetModel::class)
@if ($category->models->count() > 0)
@if ($category->category_type=='asset')
@include('partials.models-bulk-actions')
@endif
@endif
@endcan
<table
data-columns="{{ \App\Presenters\AssetModelPresenter::dataTableLayout() }}"
@ -152,7 +154,7 @@
data-sort-order="asc"
id="asssetModelsTable"
class="table table-striped snipe-table"
data-url="{{ route('api.models.index', ['status' => request('status')]) }}"
data-url="{{ route('api.models.index', ['status' => request('status'), 'category_id' => $category->id]) }}"
data-export-options='{
"fileName": "export-models-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]