main
Last change
on this file since 69e9f5d was c454c0f, checked in by bube-ristovska <ristovska725@…>, 11 months ago |
First commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[c454c0f] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace Database\Factories;
|
---|
| 4 |
|
---|
| 5 | use Illuminate\Database\Eloquent\Factories\Factory;
|
---|
| 6 | use Illuminate\Support\Facades\Hash;
|
---|
| 7 | use Illuminate\Support\Str;
|
---|
| 8 |
|
---|
| 9 | /**
|
---|
| 10 | * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
---|
| 11 | */
|
---|
| 12 | class UserFactory extends Factory
|
---|
| 13 | {
|
---|
| 14 | /**
|
---|
| 15 | * The current password being used by the factory.
|
---|
| 16 | */
|
---|
| 17 | protected static ?string $password;
|
---|
| 18 |
|
---|
| 19 | /**
|
---|
| 20 | * Define the model's default state.
|
---|
| 21 | *
|
---|
| 22 | * @return array<string, mixed>
|
---|
| 23 | */
|
---|
| 24 | public function definition(): array
|
---|
| 25 | {
|
---|
| 26 | return [
|
---|
| 27 | 'name' => fake()->name(),
|
---|
| 28 | 'email' => fake()->unique()->safeEmail(),
|
---|
| 29 | 'email_verified_at' => now(),
|
---|
| 30 | 'password' => static::$password ??= Hash::make('password'),
|
---|
| 31 | 'remember_token' => Str::random(10),
|
---|
| 32 | ];
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | /**
|
---|
| 36 | * Indicate that the model's email address should be unverified.
|
---|
| 37 | */
|
---|
| 38 | public function unverified(): static
|
---|
| 39 | {
|
---|
| 40 | return $this->state(fn (array $attributes) => [
|
---|
| 41 | 'email_verified_at' => null,
|
---|
| 42 | ]);
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.