title: Laravel Eloquent search multiple fields and relationship
body: <p>I am trying to create a search query so that I can search the same string across a few different fields. The query also needs to search fields from the <code>machine_warranties</code> which is setup as a hasOne relationship on the <code>Machines</code> model. </p>
  
  <p>Here's the warranty relationship in the Machines model</p>
  
  <pre><code>public function warranty()
  {
      return $this-&gt;hasOne('App\MachineWarranty', 'machine_id');
  }
  </code></pre>
  
  <p>Here's my attempt at the query. Searching for a serial or machine type works fine but I cannot figure out how to also search the relation. </p>
  
  <pre><code>Machine::orderBy('created_at', 'desc')
    -&gt;where('serial', 'LIKE', '%' . $search . '%')
    -&gt;orWhere('type', 'LIKE', '%' . $search . '%')
    -&gt;with(['warranty' =&gt; function($query) use ($search) {
         $query-&gt;where('first_name', 'LIKE', '%' . $search . '%');
    }]);
  </code></pre>
  
  <p>Is there a way to do <code>-&gt;orWith()</code> maybe?</p>