Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/database/Factories/UserFactory.php
10276 views
1
<?php
2
3
namespace Database\Factories;
4
5
use Carbon\Carbon;
6
use Ramsey\Uuid\Uuid;
7
use Illuminate\Support\Str;
8
use Illuminate\Database\Eloquent\Factories\Factory;
9
10
/**
11
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Pterodactyl\Models\User>
12
*/
13
class UserFactory extends Factory
14
{
15
/**
16
* Define the model's default state.
17
*/
18
public function definition(): array
19
{
20
static $password;
21
22
return [
23
'external_id' => null,
24
'uuid' => Uuid::uuid4()->toString(),
25
'username' => $this->faker->userName . '_' . Str::random(10),
26
'email' => Str::random(32) . '@example.com',
27
'name_first' => $this->faker->firstName,
28
'name_last' => $this->faker->lastName,
29
'password' => $password ?: $password = bcrypt('password'),
30
'language' => 'en',
31
'root_admin' => false,
32
'use_totp' => false,
33
'created_at' => Carbon::now(),
34
'updated_at' => Carbon::now(),
35
];
36
}
37
38
/**
39
* Indicate that the user is an admin.
40
*/
41
public function admin(): static
42
{
43
return $this->state(['root_admin' => true]);
44
}
45
}
46
47