mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-20 07:13:45 +02:00
update all model factories
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Pterodactyl\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
@@ -21,6 +22,35 @@ class UserFactory extends Factory
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [];
|
||||
static $password;
|
||||
|
||||
return [
|
||||
'external_id' => $this->faker->unique()->isbn10,
|
||||
'uuid' => $this->faker->uuid,
|
||||
'username' => $this->faker->userName,
|
||||
'email' => $this->faker->safeEmail,
|
||||
'name_first' => $this->faker->firstName,
|
||||
'name_last' => $this->faker->lastName,
|
||||
'password' => $password ?: $password = bcrypt('password'),
|
||||
'language' => 'en',
|
||||
'root_admin' => false,
|
||||
'use_totp' => false,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the user is an admin.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
public function admin(): Factory
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'root_admin' => true,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user