title: Creating Product with Properties and Photos - Laravel 5.3
body: <p>I'm trying to build an online store with Laravel 5.3. I have everything working fine, but I have no idea how to realize Product creation.
  Every Product (Product model) may have Properties (Property model) and some Photos (Photo model).</p>
  
  <p>Actually, the problem is adding photos and properties while creating new product. Photo and Property models have "product_id" column.</p>
  
  <p>How can I dynamically add photos and properties if the final product does not exist yet? Photos and properties are processed with AJAX call, to make product creation easy and more functional.</p>
  
  <p>I have no idea how to deal with it.</p>
  
  <p>Tables:</p>
  
  <pre><code>/* Photo table */
  id UINT(10) INDEX KEY
  filename VARCHAR(255)
  width INT(10)
  height INT(10)
  product_id UINT(10) FOREIGN KEY REFERENCES `id` on `products`
  
  /* Property table */
  id UINT(10) INDEX KEY
  property_name_id UINT(10) FOREIGN KEY REFERENCES `id` on `property_names`
  product_id UINT(10) FOREIGN KEY REFERENCES `id` on `products`
  value VARCHAR(255)
  
  /* Product table */
  id UINT(10) INDEX KEY
  ... many other columns
  </code></pre>
  
  <p>Why don't I just use Prestashop or similar projects? I don't need 3/4 of their functions. It will be connected with other project, so I need to create everything from scratch.</p>
  
  <p>Thanks in advance!</p>