Lae/database/factories/UserFactory.php

41 lines
969 B
PHP
Raw Normal View History

2022-08-12 07:56:56 +00:00
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
2022-11-06 11:28:22 +00:00
use Illuminate\Support\Str;
2022-08-12 07:56:56 +00:00
2022-11-06 11:28:22 +00:00
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
2022-08-12 07:56:56 +00:00
class UserFactory extends Factory
{
/**
2022-09-08 16:12:02 +00:00
* Define the model's default state.
2022-08-12 07:56:56 +00:00
*
2022-11-06 11:28:22 +00:00
* @return array<string, mixed>
2022-08-12 07:56:56 +00:00
*/
2022-09-08 16:12:02 +00:00
public function definition()
2022-08-12 07:56:56 +00:00
{
2022-09-08 16:12:02 +00:00
return [
2022-11-06 11:28:22 +00:00
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
2022-09-08 16:12:02 +00:00
];
2022-08-12 07:56:56 +00:00
}
2022-11-06 11:28:22 +00:00
/**
* Indicate that the model's email address should be unverified.
*
* @return static
*/
public function unverified()
{
return $this->state(fn(array $attributes) => [
2022-11-06 11:28:22 +00:00
'email_verified_at' => null,
]);
}
2022-08-12 07:56:56 +00:00
}