$req = request();
if ($req->get('reference_no')){
$advance_qry = $req->input('reference_no');
$requestData = ['reference_no', 'agency_ref_no', 'status','property_status'];
$query->where(function($q) use($requestData, $advance_qry) {
foreach ($requestData as $field)
$q->orWhere($field, 'like', "%{$advance_qry}%");
});
}