title: Laravel different type of products
body: <p>I'm building this app where I have various types of product (which represent not a generic product, but the actual, physical item that has been sold to a customer). I don't want to have a specific table for each one of the product types (e.g. shoes, sweatshirts, shirts, wallets) neither a big table with all the necessary fields that would remain partially null based on the product which is being stored. I'd rather have a dynamic structure, which I partially designed:</p>
  <p><a href="https://i.stack.imgur.com/1Gvks.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Gvks.png" alt="enter image description here" /></a></p>
  <p>Each product has a type (shoe, sweatshirt...) and each type has some attributes (size, color, material...), and those two are linked in the attributes_product_types table with a Many to Many relationship.</p>
  <p>The only missing part is to implement the value (e.g. 'size' =&gt; 'M', or 'color' =&gt; 'white') of a specific attribute associated to a product. For example, I know that the product of id '412' is a sweatshirt, that the sweatshirt type has size and color attributes, but I also have to say that that particular sweatshirt is an M size and white. How could I implement this in this structure and link the product to the attributes in such a way to build a correct relationship? Or is there a better way to structure this?</p>