*/ class UserFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = User::class; /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'name' => $this->faker->name(), 'email' => $this->faker->unique()->safeEmail(), 'no_telp' => $this->faker->phoneNumber(), 'email_verified_at' => now(), 'password' => bcrypt('password'), // Or use bcrypt($this->faker->password()) 'remember_token' => Str::random(10), 'role_id' => Role::factory(), // Generate a role via the Role factory ]; } /** * Indicate that the model's email address should be unverified. */ public function unverified(): static { return $this->state(fn (array $attributes) => [ 'email_verified_at' => null, ]); } }