I have been using my app with this query for over a year and it works great. Today I added a relationship to dso and I am getting this error: "Column not found: 1054 Unknown column 'dso_name' in 'where clause". This relationship works as expected for create and read. It just won't work in this search query. Any ideas?
public function search_customer(Request $request){
$search = $request->input('search_customer');
$this->validate(request(),[
'search_customer'=>'required|min:2'
]);
$customers = customer::with('dso')
->where('customer_name', 'LIKE', '%'.$search.'%')
->orWhere('billing_street', 'LIKE', '%'.$search.'%')
->orWhere('billing_city', 'LIKE', '%'.$search.'%')
->orWhere('service_street', 'LIKE', '%'.$search.'%')
->orWhere('service_city', 'LIKE', '%'.$search.'%')
->orWhere('main_phone', 'LIKE', '%'.$search.'%')
->orWhere('email', 'LIKE', '%'.$search.'%')
->orWhere('cc_email', 'LIKE', '%'.$search.'%')
->orWhere('rNumber', 'LIKE', '%'.$search.'%')
->orWhere('registrant', 'LIKE', '%'.$search.'%')
->orWhere('RSO', 'LIKE', '%'.$search.'%')
->orWhere('service_state', 'LIKE', '%'.$search.'%')
->orWhere('billing_state', 'LIKE', '%'.$search.'%')
->orWhere('dso_name', 'LIKE', '%'.$search.'%')
->get();
return response()->json($customers);
}