title: Search based on foreign key in Laravel
body: <p>Laravel 5.*</p>
  
  <p>I have the <code>Case</code> Model that has one to one relationship with <code>Customer</code> Model as defined below:</p>
  
  <pre><code>public function customer
  {
     return $this-&gt;hasOne(Customer::class, 'id', 'customer');
  }
  </code></pre>
  
  <p>In the cases listing (cases.index), it displays the customer name based on relationship <code>$case-&gt;customer-&gt;name</code>.</p>
  
  <p>I am trying to create search and list all the cases based on customer name.</p>
  
  <p>Is there a native way to search based on the relationship?</p>