I use https://laravel.com/docs/10.x/eloquent-factories quite extensively. Here's an https://peterbabic.dev/blog/convenient-relationship-factories-in-laravel-8/, in case you are interested.
The current docs show the following example for using Factory States: state(function (array $attributes) { return [ 'account_status' => 'suspended', ]; }); }} Now enable factories using HasFactory trait on the User model: suspended()->create(); Pretty useful and pretty self-explanatory.
Now take a look at the factory() method: */ public static function factory($count = null, $state = []) { $factory = static::newFactory()?: Factory::factoryForModel(get_called_class()); return $factory ->count(is_numeric($count)?