1
我想在我的faker中創建兩個獨特的用戶。我想知道正確的做法。Laravel:我如何在我的laravel faker中生成兩個獨特的種子
$factory->define(App\User::class, function (Faker\Generator $faker) {
static $password;
return [
{
'name' => "Person 1",
'email' => "[email protected]",
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
'role' => 'super',
},
{
'name' => "Person 2",
'email' => "[email protected]",
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
'role' => 'admin',
},
];
});
什麼本作是 - '$陣列='? – zhekaus
我在數組變量 –
裏面存儲了唯一值爲什麼?之後你就不用它了。 – zhekaus