title: Laravel: Products,Categories and SubCategories! (Relation ships)
body: <p>I have a problem! I make something but, not work so i will ask u for help! So the problem is</p>
  
  <p>I have this tables</p>
  
  <pre><code>products:
    name,subcategory_id,category_id,price,description
  Categories:
    name,slug,timestamps
  SubCategories:
    name,slug,timestamps
  </code></pre>
  
  <p>I want to make when smo call this url <code>/category/{category}/{subcategory}</code>
  to get all products of subcategory are called! But when product don't have sub category to open only category , i mean <code>/category/{category}</code></p>
  
  <p>Thanks guys!</p>