title: Filter a Polymorphic Table
body: <p>Basically i've a polymorphic table that is as follows:</p>
  
  <pre><code>Polytable
  --------
  
  id
  type
  polyable_type
  polyable_id
  </code></pre>
  
  <p>And the woly <code>Eloquent</code> polymorphic class is as follows:</p>
  
  <pre><code>class poly extends Eloquent {
       .... //eloquent attributes and stuff
  
       public function polyable()
       {
           return $this-&gt;morphTo();
       }
  }
  </code></pre>
  
  <p>And the woly <code>Eloquent</code> standard class is as follows:</p>
  
  <pre><code>class woly extends Eloquent{
      ... //skipped most eloquent stuff
  
      public function poly()
      {
          return $this-&gt;morphMany('poly','polyable');
      }
      public function polyTypeOne()
      {
          return $this-&gt;poly()-&gt;where('type','=','1')-&gt;get();
      }
  }
  </code></pre>
  
  <p>Now, i want <code>woly</code>'s polymorphic relationship <code>poly()</code> to return only items where <code>type</code> column in Polytable is <code>1</code>.</p>
  
  <p>So far i've hit into the database performance issue, with the function <code>polyTypeOne()</code></p>
  
  <p><strong>Example of Using polyTypeOne function</strong></p>
  
  <pre><code>$wollies = woly::all();
  foreach($wollies as $w)
  {
      $w-&gt;polyTypeOne = $w-&gt;polyTypeOne();
  }
  </code></pre>
  
  <p>What is the best way to perform such a function?</p>