source: database/factories/UserFactory.php@ 75151c6

main
Last change on this file since 75151c6 was c454c0f, checked in by bube-ristovska <ristovska725@…>, 12 months ago

First commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1<?php
2
3namespace Database\Factories;
4
5use Illuminate\Database\Eloquent\Factories\Factory;
6use Illuminate\Support\Facades\Hash;
7use Illuminate\Support\Str;
8
9/**
10 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
11 */
12class 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.