title: Laravel 7 filter search: Call to a member function where() on string
body: <p>I have a database with these parameters and I'd like to filter search them, it has been working until I added &quot;race&quot; and &quot;dealer experience&quot; and I can't for the life of me figure out why.</p>
  <p>dealer_experience is a string, but I don't think that would make a difference ?</p>
  <p>Here is my controller code: `  public function index(Request $request){</p>
  <pre><code>    $title = $request-&gt;get('title');
  
      $type = $request-&gt;get('type');
  
      $category = $request-&gt;get('category_id');
      
      $province = $request-&gt;get('province');
  
      $brand= $request-&gt;get('brand_id');
  
      $address = $request-&gt;get('address');
  
      $race = $request-&gt;get('race');
  
      $dealer_experience = $request-&gt;get('dealer_experience');
  
      if($title||$type||$category||$address||$brand||$race||$dealer_experience) {
          $candidates = Profile::query();
          if ($title) {
              $candidates = $candidates-&gt;where('title','LIKE','%'.$title.'%');
          }
        
          
          if ($category) {
              $candidates = $candidates-&gt;where('category_id',$category);
          }
  
            
          if ($brand) {
              $candidates = $candidates-&gt;where('brand_id',$brand);
          }
  
          if ($type) {
              $candidates = $candidates-&gt;where('type',$type);
              
          }
  
           
          
          if ($address) {
              $candidates = $candidates-&gt;where('address','LIKE','%'.$address.'%');
          }
  
          if ($race ) {
              $race  = $race -&gt;where('race',$race);
          }
  
          if ($dealer_experience) {
              $dealer_experience = $dealer_experience-&gt;where('dealer_experience',$dealer_experience);
              
          }    
      
  
          $candidates = $candidates-&gt;where('profile_status',1)-&gt;paginate(5);
       
          return view('profile.allcandidates',compact('candidates')); 
      }
      else
      {
          $candidates= Profile::latest()-&gt;where('profile_status',1)-&gt;paginate(2);
       
          return view('profile.allcandidates',compact('candidates'));
  
      }
  
  }
  </code></pre>
  <p>}`</p>
  <p>Any and all help would be appreciated, thank you</p>