adrema/database/factories/UserFactory.php

36 lines
793 B
PHP
Raw Normal View History

2021-11-23 19:15:39 +01:00
<?php
namespace Database\Factories;
use App\User;
use Illuminate\Database\Eloquent\Factories\Factory;
2022-02-19 15:18:24 +01:00
use Illuminate\Support\Facades\Hash;
2021-11-23 19:15:39 +01:00
/**
* @extends Factory<User>
*/
class UserFactory extends Factory
{
protected $model = User::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
2022-02-19 15:18:24 +01:00
'email' => $this->faker->safeEmail,
'password' => Hash::make('password'),
2024-07-31 22:41:02 +02:00
'firstname' => $this->faker->firstName,
'lastname' => $this->faker->lastName,
2021-11-23 19:15:39 +01:00
];
}
2024-12-07 14:55:14 +01:00
public function loginData(string $email, string $password): self
{
return $this->state(['email' => $email, 'password' => Hash::make($password)]);
}
2021-11-23 19:15:39 +01:00
}