title: Laravel Eloquent ORM filtering with appended attribute
body: <p>I'm making a filter and I need to append to model a attribute that doesn't exist and then use it for filtering table. I try with where() but the problem is that it isn't found the appended attribute. Here is an example code:</p>
  
  <pre><code>&lt;?php
  
  class School extends Eloquent {
  
      protected $table = 'schools';
      protected $appends = array('municipality_id');
  
      public function getMunicipalityIdAttribute()
      {
          return City::find($this-&gt;city_id)-&gt;municipality_id;
      }
  
      public function listSchoolsEndUser()
      {
          $schools_data = new School;
  
          if ( Input::has('municipality') ) {
              $schools_data = $schools_data-&gt;where('municipality_id', '=', Input::get('municipality'));
          }
  
          $schools_data = $schools_data-&gt;paginate(12);
  
          return $schools_data;
      }
  }
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>SQLSTATE[42S22]: Column not found: 1054 Unknown column municipality_id' in 'where clause' (SQL: select count(*) as aggregate from `schools` where (`specialties` like %"5"%) and `municipality_id` = 6)
  </code></pre>