public function getDefaults(Faker $faker): array
{
return [
'name' => $faker->name,
'recipe_id' => factory(Recipe::class),
];
}
public function getDefaults(Faker $faker): array
{
return [
'name' => $faker->name,
'recipe_id' => RecipeFactory::new(),
];
}
public function create(array $extra = []): Group
{
return $this->build($extra);
}
public function make(array $extra = []): Group
{
return $this->build($extra, 'make');
}
public function active(): UserFactory
{
return tap(clone $this)->overwriteDefaults([
'active' => true,
]);
}
class UserFactory
{
protected string $modelClass = User::class;
protected bool $immutable = true;
// ...
public function active(): UserFactory
{
return $this->overwriteDefaults([
'active' => true,
]);
}
}