title: Laravel 4 - How to use where conditions for relation's column
body: <p>This is what I want, I have two tables. one is 'Restaurants' and other is 'Facilities'.</p>
  
  <p>The tables are simple.. and One-To-One relations. like there is a restaurant table with <code>id</code>, <code>name</code>, <code>slug</code>, etc and another table called <code>facilities</code> with <code>id</code>, <code>restaurant_id</code>, <code>wifi</code>, <code>parking</code>, etc</p>
  
  <p>Here are my models:</p>
  
  <pre><code>class Restaurant extends Eloquent {
  
  protected $table = 'restaurants';
  
  public function facilities() {
      return $this-&gt;hasOne('Facilities'); 
  }
  }
  
  class Facilities extends Eloquent {
  
  protected $table = 'facilities';
  
  public function restaurant() {
      return $this-&gt;belongsTo('Restaurant');
   }
  
  
  }
  </code></pre>
  
  <p>I want do like this <code>Select * from restaurants r left join facilities rf on r.id=rf.restaurant_id where r.name = 'bbq' and rf.wifi != '1'</code>.</p>
  
  <p>How to use Eloquent to do that? </p>
  
  <p>ps. sorry for modify from <a href="https://stackoverflow.com/questions/14621943/laravel-how-to-use-where-conditions-for-relations-column#_=_">https://stackoverflow.com/questions/14621943/laravel-how-to-use-where-conditions-for-relations-column#<em>=</em></a> , but I have the similar problem.</p>