Dynamic Where clause in query with eloquent in Laravel 5.2

public function getObjs($enquiry_status = null, $enquiry_case_type = null, $from_date = null, $to_date = null)
{
    $query = Enquiry::query();
    if(isset($enquiry_status) && $enquiry_status != null){
        $query = $query->where('status', $enquiry_status);
    }
    if(isset($enquiry_case_type) && $enquiry_case_type != null){
        $query = $query->where('case_type', '$enquiry_case_type');
    }
    if(isset($from_date) && $from_date != null){

        $query = $query->where('date', '>' , '$from_date');
    }
    if(isset($to_date) && $to_date != null){
        $query = $query->where('date', '<', '$to_date');
    }
    $query = $query->whereNull('deleted_at');
    $objs = $query->get();
    return $objs;
}

JQuery multiselect – Set a value as selected in the multiselect dropdown

======================================
To Select
=====================================
i = 0, size = allergies.length; 
for(i; i < size; i++){ $("#allergies").multiselect("widget").find(":checkbox[value='"+allergies[i]+"']").attr("checked","checked"); 
$("#allergies option[value='" + allergies[i] + "']").attr("selected", 1); 
$("#allergies").multiselect("refresh"); }


======================================
To UnSelect
=====================================

$("#allergies").multiselect("uncheckAll");