Model factories can be used to insert test data into the database. See Laravel Documentation for more information. The only difference si the class your factory need to extend:
UserFrosting\Sprinkle\Core\Database\Factories\Factory
;Illuminate\Database\Eloquent\Factories\HasFactory
trait;newFactory
method in your model, returning your factory:
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return UserFactory::new();
}
$user = User::factory()->create();