1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-24 07:17:55 +01:00

49 lines
1.3 KiB
PHP
Raw Normal View History

<?php /** @noinspection PhpUnused */
2021-07-30 19:26:02 +02:00
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use JetBrains\PhpStorm\ArrayShape;
use Illuminate\Support\Carbon;
2021-07-30 19:26:02 +02: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.
*
* @noinspection PhpUndefinedMethodInspection
2021-07-30 19:26:02 +02:00
*/
#[ArrayShape(['name' => 'string', 'email' => 'mixed', 'email_verified_at' => Carbon::class, 'password' => 'string', 'remember_token' => 'string'])]
public function definition(): array
{
return [
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
2021-07-30 19:26:02 +02:00
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): Factory
2021-07-30 19:26:02 +02:00
{
return $this->state(function () {
2021-07-30 19:26:02 +02:00
return [
'email_verified_at' => null,
];
});
}
}