У меня есть модель ParentItem
$parentItem = ParentItem::get()->first();
У меня есть этот массив
$items = array(
array(
'title' => 'test1',
'desc' => 'test1'
),
array(
'title' => 'test2',
'desc' => 'test2'
)
);
Я хочу добавить его, так как у него много связей.
чтобы я мог это сделать:
foreach($items as $item) {
$parentItem->items()->create($item)
}
есть ли способ создать все сразу?
что-то вроде:
$parentItem->items()->createMany($items);
Подробнее здесь: https://stackoverflow.com/questions/352 ... eate-multi