mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Speed up user factory by only bcrypting once
This commit is contained in:
parent
2d758be0e1
commit
7e0c33d535
|
@ -2,19 +2,17 @@
|
||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
|
||||||
|
$password = bcrypt('password');
|
||||||
|
|
||||||
|
$factory->define(App\Models\User::class, function (Faker\Generator $faker) use ($password) {
|
||||||
$factory->define(App\Models\User::class, function (Faker\Generator $faker) {
|
|
||||||
return [
|
return [
|
||||||
'first_name' => $faker->firstName,
|
'first_name' => $faker->firstName,
|
||||||
'last_name' => $faker->lastName,
|
'last_name' => $faker->lastName,
|
||||||
'username' => $faker->username,
|
'username' => $faker->username,
|
||||||
'password' => bcrypt('password'),
|
'password' => $password,
|
||||||
'permissions' => '{"user":"0"}',
|
'permissions' => '{"user":"0"}',
|
||||||
'email' => $faker->safeEmail,
|
'email' => $faker->safeEmail,
|
||||||
'company_id' => function () {
|
'company_id' => rand(1,4),
|
||||||
return factory(App\Models\Company::class)->create()->id;
|
|
||||||
},
|
|
||||||
'locale' => $faker->locale,
|
'locale' => $faker->locale,
|
||||||
'employee_num' => $faker->numberBetween(3500, 35050),
|
'employee_num' => $faker->numberBetween(3500, 35050),
|
||||||
'jobtitle' => $faker->jobTitle,
|
'jobtitle' => $faker->jobTitle,
|
||||||
|
|
Loading…
Reference in a new issue