I have the following code:
$this->actingAs(factory('App\User')->create());
$thread = factory('App\Thread')->make();
what is the difference between create() and make() and why is it not listed in the helper functions page in the Laravel documentation? Thank you! :)
create
persists to the database while make
just creates a new instance of the model.
The
create
method not only creates the model instances but also saves them to the database using Eloquent's save method
https://laravel.com/docs/5.4/database-testing#using-factories
If you'd like to see the source code differences between make and create you can see them in src/Illuminate/Database/Eloquent/FactoryBuilder.php