Path: blob/1.0-develop/database/Factories/UserFactory.php
7458 views
<?php12namespace Database\Factories;34use Carbon\Carbon;5use Ramsey\Uuid\Uuid;6use Illuminate\Support\Str;7use Pterodactyl\Models\User;8use Illuminate\Database\Eloquent\Factories\Factory;910class UserFactory extends Factory11{12/**13* The name of the factory's corresponding model.14*15* @var string16*/17protected $model = User::class;1819/**20* Define the model's default state.21*/22public function definition(): array23{24static $password;2526return [27'external_id' => null,28'uuid' => Uuid::uuid4()->toString(),29'username' => $this->faker->userName . '_' . Str::random(10),30'email' => Str::random(32) . '@example.com',31'name_first' => $this->faker->firstName,32'name_last' => $this->faker->lastName,33'password' => $password ?: $password = bcrypt('password'),34'language' => 'en',35'root_admin' => false,36'use_totp' => false,37'created_at' => Carbon::now(),38'updated_at' => Carbon::now(),39];40}4142/**43* Indicate that the user is an admin.44*/45public function admin(): static46{47return $this->state(['root_admin' => true]);48}49}505152