Laravel - Database - Instantiating Models

Once you have defined your factories, you may use the static factory method provided to your models by the Illuminate\Database\Eloquent\Factories\HasFactory trait in order to instantiate a factory instance for that model. Let's take a look at a few examples of creating models. First, we'll use the make method to create models without persisting them to the database:

    use App\Models\User;
    public function test_models_can_be_instantiated()
        $user = User::factory()->make();
        // Use model in tests...

You may create a collection of many models using the count method:

    $users = User::factory()->count(3)->make();