title: Laravel factories being consumed by table seeders and tests. Best practices/How to do it
body: <p>I'm trying to write some Laravel <code>factories</code> so that we can seed all tables upfront and also use them for tests.</p>
  
  <p><em>I'm not very experienced with testing and I have some doubts on which premises should factories be built.</em></p>
  
  <p>Let's use this simple example, 2 tables:</p>
  
  <ul>
  <li>users</li>
  <li>notes</li>
  </ul>
  
  <p>Notes have a <code>user_id</code> field with a <code>FK</code>.</p>
  
  <p>Should I make the <code>notes</code> factory to be able to create <code>users</code> (calling <code>users</code> factory) or expect that in any test that I try to create <code>notes</code> I 
   have already created <code>users</code> that can be associated with the <code>notes</code>? </p>
  
  <p>Please give some practical example if you may.</p>