using factories in tests
This commit is contained in:
21
database/factories/User.php
Normal file
21
database/factories/User.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Auth\User;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(User::class, function (Faker $faker) {
|
||||
$password = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'; // password
|
||||
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'password' => $password,
|
||||
'password_confirmation' => $password,
|
||||
'remember_token' => Str::random(10),
|
||||
'locale' => 'en-GB',
|
||||
'companies' => ['1'],
|
||||
'roles' => ['1'],
|
||||
'enabled' => $this->faker->boolean ? 1 : 0,
|
||||
];
|
||||
});
|
Reference in New Issue
Block a user