*/ class MembershipFactory extends Factory { public $model = Membership::class; /** * Define the model's default state. * * @return array */ public function definition() { return [ 'group_id' => Group::factory()->createOne()->id, 'from' => now()->subMonths(3), ]; } public function inNami(int $namiId): self { return $this->state(['nami_id' => $namiId]); } }