added search to product lis

main
A1Gard 5 months ago
parent 23e5127e53
commit 7bcd5a5a8f

@ -172,10 +172,12 @@ class ProductController extends Controller
if ($request->filter == 'TRASH'){
$n = $n->onlyTrashed();
}else{
$n = $n->where('stock_status', $request->filter);
}
}
if ($request->has('q')){
$n->where('name','LIKE','%'.$request->input('q').'%');
}
$products = $n->paginate(20);
return view('admin.product.productIndex', compact('products'));
}

@ -7,6 +7,12 @@
<div class="container">
@include('starter-kit::component.err')
<form action="" class="my-2">
<label for="q">
</label>
<input id="q" type="search" name="q" value="{{request()->get('q')}}" class="form-control" placeholder="{{__("Search")}}...">
</form>
<div class="alert alert-dark">
<span>
{{__("Filter")}}:
@ -45,7 +51,7 @@
</th>
<th>
{{__("Action")}}
<a href="{{route('admin.product.create')}}" class="btn btn-success float-start"><i
<a href="{{route('admin.product.create')}}" class="btn btn-success float-end"><i
class="fa fa-plus"></i></a>
</th>
</tr>

Loading…
Cancel
Save