*/ class UserFactory extends Factory { protected $model = User::class; /** * Define the model's default state. * * @return array */ public function definition() { return [ 'email' => $this->faker->safeEmail, 'password' => Hash::make('password'), 'firstname' => $this->faker->firstName, 'lastname' => $this->faker->lastName, ]; } public function loginData(string $email, string $password): self { return $this->state(['email' => $email, 'password' => Hash::make($password)]); } }