title: Filtering eloquent collection with foreign table's attribute
body: <p>I have a users table and I am trying to return the data to a view after filtering the collection with its foreign table (user_details) by the attribute where "status" = "1".</p>
  
  <p>I have researched and tried many method suggested online such as </p>
  
  <pre><code>$users = Users::whereHas('details_id', function($query) {
      $query-&gt;where('status', '1');
  })-&gt;get()-&gt;paginate(15);
  </code></pre>
  
  <p>But I am getting an error of </p>
  
  <blockquote>
    <p>Call to undefined method App\Models\User::details_id()</p>
  </blockquote>
  
  <p>This is my User's model below: -</p>
  
  <pre><code>public function user_details() 
  {
      return $this-&gt;hasOne(UserDetails::class, "id");
  }
  </code></pre>