using factories in tests

This commit is contained in:
denisdulici
2019-11-22 17:35:46 +03:00
parent a4135ec902
commit 7ba71d17c5
5 changed files with 31 additions and 49 deletions

View 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,
];
});