laravel / 10 / api / 10.x / illuminate / database / eloquent / factories / hasfactory.html

HasFactory

trait HasFactory (View source)

Methods

static Factory<static> factory(callable|array|int|null $count = null, callable|array $state = [])

Get a new factory instance for the model.

static Factory<static> newFactory()

Create a new factory instance for the model.

Details

static Factory<static> factory(callable|array|int|null $count = null, callable|array $state = [])

Get a new factory instance for the model.

Parameters

callable|array|int|null $count
callable|array $state

Return Value

Factory<static>

static protected Factory<static> newFactory()

Create a new factory instance for the model.

Return Value

Factory<static>

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Database/Eloquent/Factories/HasFactory.html