update all model factories

This commit is contained in:
Matthew Penner
2021-01-15 18:01:48 -07:00
parent c18e186589
commit d550d770da
18 changed files with 759 additions and 212 deletions

View File

@@ -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,
];
});
}
}