title: Laravel Eloquent relation depending on type of item
body: <p>I have model <code>Product</code>, it has 2 types: <code>Lamps</code> and <code>Bulbs</code>. A lamp have set of attributes that differs from a bulb, so I have 2 another models <code>Lamp</code> and <code>Bulb</code> which represent set of attributes. What type of relation from Product to attribute model should I implement in this situation?</p>
  
  <p>I've been trying one-to-one relation, but in my situation this second "one" differs from product's type.</p>
  
  <p>I've been thinking of <strong>EAV</strong> pattern, but I don't want tons of joins in my architecture right now because I don't need more than these two types of item.</p>
  
  <p>What would you suggest?</p>
  
  <p><strong>UPD1:</strong> here are the tables (simplified):</p>
  
  <pre><code>mysql&gt; show columns from products;
  +-------------+--------------+------+-----+---------+----------------+
  | Field       | Type         | Null | Key | Default | Extra          |
  +-------------+--------------+------+-----+---------+----------------+
  | id          | int(11)      | NO   | PRI | NULL    | auto_increment |
  | name        | varchar(127) | NO   |     | NULL    |                |
  | price       | double       | NO   |     | NULL    |                |
  | old_price   | double       | NO   |     | NULL    |                |
  | category_id | int(11)      | NO   |     | NULL    |                |
  +-------------+--------------+------+-----+---------+----------------+
  5 rows in set (0.00 sec)
  
  mysql&gt; show columns from lamps;
  +------------+---------+------+-----+---------+----------------+
  | Field      | Type    | Null | Key | Default | Extra          |
  +------------+---------+------+-----+---------+----------------+
  | id         | int(11) | NO   | PRI | NULL    | auto_increment |
  | product_id | int(11) | NO   |     | NULL    |                |
  | width      | int(11) | NO   |     | NULL    |                |
  | height     | int(11) | NO   |     | NULL    |                |
  | length     | int(11) | NO   |     | NULL    |                |
  | weight     | int(11) | NO   |     | NULL    |                |
  +------------+---------+------+-----+---------+----------------+
  7 rows in set (0.00 sec)
  
  mysql&gt; show columns from bulbs;
  +------------+---------+------+-----+---------+----------------+
  | Field      | Type    | Null | Key | Default | Extra          |
  +------------+---------+------+-----+---------+----------------+
  | id         | int(11) | NO   | PRI | NULL    | auto_increment |
  | product_id | int(11) | NO   |     | NULL    |                |
  | voltage    | int(11) | NO   |     | NULL    |                |
  | power      | int(11) | NO   |     | NULL    |                |
  | base       | int(11) | NO   |     | NULL    |                |
  | type       | int(11) | NO   |     | NULL    |                |
  +------------+---------+------+-----+---------+----------------+
  6 rows in set (0.00 sec)
  </code></pre>
  
  <p><strong>UPD2:</strong> I understand that I can use two foreign keys in products table and set up only one of them for each record, but is there some more elegant scheme for this situation?</p>