Update to Laravel 8
Co-authored-by: Matthew Penner <me@matthewp.io>
This commit is contained in:
parent
028921b42a
commit
a043071e3c
211 changed files with 4394 additions and 2933 deletions
57
database/Factories/UserFactory.php
Normal file
57
database/Factories/UserFactory.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Pterodactyl\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
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
|
||||
{
|
||||
static $password;
|
||||
|
||||
return [
|
||||
'external_id' => $this->faker->unique()->isbn10,
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
'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 a new issue