title: How to pass arguments to Laravel factories?
body: <p>I have a <code>users</code> table and a one-to-zero/one relation with a <code>businesses</code> table (users.user_id => businesses.user_id). On my <code>users</code> table I have a discriminator which tells me if the user is of type business and therefore I need to have details on the <code>businesses</code> table as well.</p>
  
  <p>I want to create my Users with my factory which currently is working and then only create business details where the discriminator points to a business account. </p>
  
  <p>I have three options in my mind:</p>
  
  <ol>
  <li>Create from users factory and then using '->each()' do some checks on the discriminator and create a new business user using a the factory. However I cannot pass to the business factory the <code>user_id</code> that the user was assigned.  </li>
  <li>First create the users. Then in my Business seeder, retrieve all Users that match a 'business' discriminator. Then for all of these users run a factory that creates the business details. But again, I would have to link somehow the <code>user_id</code> of the already create user with the business factory <code>user_id</code>.  </li>
  <li>In my business factory, create a new User and retrieve the id, thus making the link between <code>users.user_id</code> and <code>business.user_id</code>. However I am using a random generator for <code>user.user_type</code> so even if I have the <code>businesses</code> table filled it might be for users that have the discriminator as 'personal'.</li>
  </ol>
  
  <p>Is there another way? Can I pass arguments from my Seeder to the factory?</p>