我该如何在Laravel中使用ModelFactory生成多个数据行?
在ModelFactory.php
文件中,我有以下代码:
$factory->define(App\User::class, function (Faker $faker) {
static $password;
return [
'name' => 'Admin',
'Description' => 'Administrators have full access to everything.'
];
});
如何在不使用原始表达式的情况下添加以下数组?
[
'name' => 'Admin',
'description' => 'Administrators have full access to everything.',
],
[
'name' => 'User',
'description' => 'User have normal access.',
],
谢谢
$factory->state(App\User::class, 'admin', function...
- Michael K.