title: Laravel hasMany with where in a Polymorphic relationship
body: <p>I have 3 tables, Cars, Flats and Shops. Each table has its photos. Photos is stored in database. I want to use only one table for photos, I don't want to create Photos table for each Cars, Flats and Shops.</p>
  
  <p>Photos tables structe is like this;</p>
  
  <pre><code>| id |           photo_url        | type  | destination_id |
  ------------------------------------------------------------
    1  |   http://example.com/1.jpg | Cars  |      1         |
    2  |   http://example.com/2.jpg | Flats |      1         |
    3  |   http://example.com/3.jpg | Flats |      2         |
    4  |   http://example.com/4.jpg | Shops |      1         |
    5  |   http://example.com/3.jpg | Shops |      2         |
  </code></pre>
  
  <p>I need to define hasMany relationship with type in Shops, Flats and Cars model classes.</p>
  
  <p>What is the correct way to do this?</p>