$diplomas =Diploma::where('status','published')
->when($keyword,function($query,$keyword){
return $query->where('diplomas.title','like','%'. $keyword .'%');
})
->when(($min && $max),function($query)use($min, $max){
return $query->where('diplomas.current_price','>=', $min)->where('diplomas.current_price','<=', $max);
})
->paginate(9);
$queryResult['diplomas']= $diplomas;
Frequently Asked Questions