title: Laravel 5.3 Call to undefined method Illuminate\Database\Eloquent\Factory::state()
body: <p>I'm trying to define a few different variations of a User model for testing, using Laravels ModelFactory as documented <a href="https://laravel.com/docs/5.3/database-testing#factory-states">here</a></p>
  
  <pre><code>$factory-&gt;define(App\User::class, function(\Faker\Generator $faker) {
      return [
          'name' =&gt; $faker-&gt;name,
          'email' =&gt; $faker-&gt;unique()-&gt;safeEmail,
          'remember_token' =&gt; str_random(10),
          'phone' =&gt; $faker-&gt;phoneNumber,
      ];
  });
  
  $factory-&gt;state(App\User::class, 'admin', function (Faker\Generator $faker) {
      return [
          'groups' =&gt; function(App\User $u) {
              return App\Models\Group::where('level', '&lt;=', 5)-&gt;get()-&gt;toArray();
          }
      ];
  });
  </code></pre>
  
  <p>And then I create a User model:</p>
  
  <pre><code>$user = factory(User::class)-&gt;states('admin')-&gt;make();
  </code></pre>
  
  <p>But phpunit seems to exit out of the test without complaining.  In the PHP logs, I see:</p>
  
  <pre><code>Call to undefined method Illuminate\Database\Eloquent\Factory::state()
  </code></pre>
  
  <p>There isn't very much documentation on the state() method in Laravel docs, and I've searched and experimented for hours with no progress to show for it.  </p>
  
  <p>As a sidenote: the <code>groups</code> attribute is referring to a Many relationship.  However, this Exception is thrown regardless of which model I am creating, even simple models.</p>