Answer the question
In order to leave comments, you need to log in
How can I get id's from the factory?
There is this code:
$options = factory(\App\Models\V1\Shop\Item\Option::class, 20)->make([
'shop_id' => $shop->id
]);
Log::info($options);
[2018-06-01 11:08:15] local.INFO: [{"shop_id":"8af50f5f-92b1-45c5-b4aa-8665340273b5","title":"...","description":null,"price":0}, ...]
Answer the question
In order to leave comments, you need to log in
factory()->make()
- create objects in memory. factory()->create()
- create objects in memory and store them in the database.
No entry in the database - no ID.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question