title: Laravel how to store premade and user made values in a queryable manner?
body: <p>I have a table called <code>templates</code> which by default contains some premade templates. Each template belongs to a <code>category</code>. A <code>category</code> can have one or many templates.</p>
  <p>Users can also create their own custom templates by modifying a premade template. What would be the best way to store this custom templates? Should i store this default templates in the same table with the premade ones?</p>
  <p>This is what i have so far:</p>
  <pre><code>categories table
  +---+----+
  |id |name|
  +---+----+
  |1  |A   |
  +---+----+
  |2  |B   |
  +---+----+   
  
  users table
  +---+-------+
  |id |name   |
  +---+-------+
  |1  |Andrew |
  +---+-------+
  |2  |Joe    |
  +---+-------+
  |3  |Emma   |
  +---+-------+
  
  templates table
  +---+------------+--------+-----------+
  |id |category_id |user_id |properties |
  +---+------------+--------+-----------+
  |1  |1           |null    |[]         |
  +---+------------+--------+-----------+
  |2  |1           |2       |[]         |
  +---+------------+--------+-----------+
  |3  |2           |null    |[]         |
  +---+------------+--------+-----------+
  </code></pre>
  <p>In this example the <code>templates</code> with &quot;null&quot; <code>user_id</code> are the default <code>templates</code> and can be seen by all users and the <code>templates</code> with a <code>user_id</code> can only be seen by that specific user.</p>
  <p>Is this a good approach?</p>