ldc-dam/database/factories/UserFactory.php

45 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2019-05-09 15:00:05 +02:00
<?php
2022-04-19 14:49:09 +02:00
namespace Database\Factories;
2022-04-19 10:49:38 +02:00
2022-04-19 14:49:09 +02:00
use Illuminate\Database\Eloquent\Factories\Factory;
2022-04-19 10:49:38 +02:00
use Illuminate\Support\Str;
2019-05-09 15:00:05 +02:00
2022-04-20 15:23:31 +02:00
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
2022-04-19 14:49:09 +02:00
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
2022-04-20 15:23:31 +02:00
* @return array<string, mixed>
2022-04-19 14:49:09 +02:00
*/
public function definition()
{
return [
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
2022-04-20 15:23:31 +02:00
// * password
2022-04-19 16:07:27 +02:00
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
2022-04-19 14:49:09 +02:00
'remember_token' => Str::random(10),
];
}
2019-05-09 15:00:05 +02:00
2022-04-19 14:49:09 +02:00
/**
* Indicate that the model's email address should be unverified.
*
2022-04-20 15:23:31 +02:00
* @return static
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
2022-04-19 14:49:09 +02:00
*/
public function unverified()
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
}