title: Laravel whereHas to realted model, and whereHas to that related modal not working
body: <p>Im having three table:</p>
  
  <p><strong>Deal Model:</strong></p>
  
  <pre><code>class Deal extends Model
  {
      protected $guarded = ['id'];
  
      public function hotel() {
          return $this-&gt;belongsTo('App\Hotel');
      }
  }
  </code></pre>
  
  <p><strong>Hotel Model:</strong></p>
  
  <pre><code>class Hotel extends Model
  {
      public function room(){
          return $this-&gt;hasMany('App\Room');
      }
  
      public function deal(){
          return $this-&gt;hasMany('App\Deal');
      }
  }
  </code></pre>
  
  <p><strong>Room Model:</strong></p>
  
  <pre><code>class Room extends Model
  {
  
      public function hotel(){
          return $this-&gt;belongsTo('App\Hotel');
      }
  
  }
  </code></pre>
  
  <p>The below query works fine,</p>
  
  <pre><code>return $greatDeals = Deal::whereHas('hotel', function ($query) {
                  $query-&gt;Where('astatus', 1)-&gt;Where('status', 0);
              })-&gt;get();
  </code></pre>
  
  <p>but i want to query the 'hotel' model wherehas 'room' model
  but the below query shows error, was this query format is correct?</p>
  
  <pre><code> return $greatDeals = Deal::whereHas('hotel', function ($query) {
                      $query-&gt;whereHas('room', function ($query) {
                          $query-&gt;Where('astatus', 1)-&gt;Where('status', 0);
                      })-&gt;get();
                  })-&gt;get();
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'deals.hotel_id' in 'where clause' (SQL: select * from `hotels` where `deals`.`hotel_id` = `hotels`.`id` and exists (select * from `rooms` where `hotels`.`id` = `rooms`.`hotel_id` and `astatus` = 1 and `status` = 0)) ◀"
  </code></pre>