I would like to know how to filter my bank data with a form where it contains more than 1 field to filter, I could only do one field only.
Form:
<form action="{{ url('panel/brands') }}" method="GET" name="frm_filter_brand" role="search">
<div class="row ls-clearfix">
<div class="ls-box-filter">
<div class="row ls-clearfix">
<div class="col-md-3">
<label class="ls-label">
<b class="ls-label-text">ID</b>
<div class="ls-field-md">
<input class="uppercase" name="id" id="id" placeholder="Ex.: 10" type="text" value="">
</div>
</label>
</div>
<div class="col-md-3">
<label class="ls-label">
<b class="ls-label-text">Nome</b>
<div class="ls-field-md">
<input class="uppercase" name="name" id="name" placeholder="Ex.: FORD" type="text" value="">
</div>
</label>
</div>
<div class="col-md-3">
<label class="ls-label">
<b class="ls-label-text">Descrição</b>
<div class="ls-field-md">
<input class="uppercase" name="description" id="description" placeholder="Ex.: Novas" type="text" value="">
</div>
</label>
</div>
<div class="">
<label style="margin-top:16px" class="ls-label ls-float-right">
<label class="ls-label">
<button id="btn-filter" type="submit" class="ls-btn ls-btn-filtrar">Filtrar</button>
</label>
</label>
</div>
</div>
</div>
</div>
</form>
My controller:
public function index(Request $request)
{
$filter_id = $request->id;
if($filter_id){
$brands = $this->brand::where('id', $filter_id)->get();
}else{
$brands = $this->brand::all();
}
return view('brand.index', compact('brands'));
}
So I would like to check what values I have entered in the filters and search them.