title: Laravel eloquent search on fields of related model
body: <p>I have an eloquent models as, </p>
  
  <p><strong>User</strong> : <em>users(id, username, password, email, status)</em></p>
  
  <p><strong>Profile</strong> : <em>profiles(id, user_id, first_name, last_name, gender, dob)</em></p>
  
  <p>In the controller logic, I am eagerly loading the Profile model.</p>
  
  <p>I can do this,</p>
  
  <pre><code>$user = User::with('Profile')-&gt;get();
  </code></pre>
  
  <p>or</p>
  
  <pre><code>$user = User::with('Profile')-&gt;where('status', '1')-&gt;get();
  </code></pre>
  
  <p>but how to do something like,</p>
  
  <pre><code>$user = User::with('Profile')-&gt;where('status', '1')-&gt;where('gender', 'Male')-&gt;get();
  </code></pre>