i am new in laravel.Actually i want to filter some data on state and typeofsupply column. like if state="south australia" and typeofsupply="Inverter & Storage" then show me these rows who exist on both value.and if i filter like state="south australia" and typeofsupply=Nul.then these rows will be display who exist state of south australia and typeofsupply should be any of list(All type of supply)
public function show(Request $request){
$typeofsupply='';
$state='';
if(!$request->all()==Null) {
if(!$request->state==Null) {
$state=$request->state;
}
if(!$request->typeofsupply==Null) {
$typeofsupply=$request->typeofsupply;
}
$items = Postjob::where('state',$state)
->where('typeofsupply',$typeofsupply)
->get();
dd($items);
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire