How to "make" multiple factory objects instead of using "create" function?
As I don't want to store the data into the database. I'd like to use make method instead of create method.
$factory->defineAs(App\Post::class, '12345', function () {
return [
[
'user_id' => function () {
return factory(App\User::class)->make()->id;
},
'status' => App\Post::STATUS_MODIFIABLE,
'created_at' => '2019-07-25 10:50:00',
],
[
'user_id' => function () {
return factory(App\User::class)->make()->id;
},
'status' => App\Post::STATUS_MODIFIABLE,
'created_at' => '2019-07-25 10:50:00',
],
];
});
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LGQUsm
via IFTTT
Aucun commentaire:
Enregistrer un commentaire