Path: blob/1.0-develop/database/Factories/UserFactory.php
10276 views
<?php12namespace Database\Factories;34use Carbon\Carbon;5use Ramsey\Uuid\Uuid;6use Illuminate\Support\Str;7use Illuminate\Database\Eloquent\Factories\Factory;89/**10* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Pterodactyl\Models\User>11*/12class UserFactory extends Factory13{14/**15* Define the model's default state.16*/17public function definition(): array18{19static $password;2021return [22'external_id' => null,23'uuid' => Uuid::uuid4()->toString(),24'username' => $this->faker->userName . '_' . Str::random(10),25'email' => Str::random(32) . '@example.com',26'name_first' => $this->faker->firstName,27'name_last' => $this->faker->lastName,28'password' => $password ?: $password = bcrypt('password'),29'language' => 'en',30'root_admin' => false,31'use_totp' => false,32'created_at' => Carbon::now(),33'updated_at' => Carbon::now(),34];35}3637/**38* Indicate that the user is an admin.39*/40public function admin(): static41{42return $this->state(['root_admin' => true]);43}44}454647