2021-01-23 12:09:16 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
2024-03-12 22:39:16 -04:00
|
|
|
use App\Models\User;
|
2025-09-24 13:34:19 +02:00
|
|
|
use Carbon\Carbon;
|
2021-01-23 12:09:16 -08:00
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
2025-09-24 13:34:19 +02:00
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
use Ramsey\Uuid\Uuid;
|
2021-01-23 12:09:16 -08:00
|
|
|
|
|
|
|
|
class UserFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $model = User::class;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Define the model's default state.
|
|
|
|
|
*/
|
|
|
|
|
public function definition(): array
|
|
|
|
|
{
|
|
|
|
|
static $password;
|
|
|
|
|
|
|
|
|
|
return [
|
2022-05-29 17:52:14 -04:00
|
|
|
'external_id' => null,
|
2025-12-17 20:09:17 +01:00
|
|
|
'is_managed_externally' => false,
|
2021-01-23 12:09:16 -08:00
|
|
|
'uuid' => Uuid::uuid4()->toString(),
|
2024-03-19 16:47:02 -04:00
|
|
|
'username' => $this->faker->userName() . '_' . Str::random(10),
|
2022-05-29 17:52:14 -04:00
|
|
|
'email' => Str::random(32) . '@example.com',
|
2021-01-23 12:09:16 -08:00
|
|
|
'password' => $password ?: $password = bcrypt('password'),
|
|
|
|
|
'language' => 'en',
|
2024-06-13 21:06:31 +02:00
|
|
|
'oauth' => [],
|
2021-01-23 12:09:16 -08:00
|
|
|
'created_at' => Carbon::now(),
|
|
|
|
|
'updated_at' => Carbon::now(),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|