Support the ongoing development of Laravel.io →
Input Eloquent Forms
Last updated 2 years ago.
0

A couple things. Product should belongTo Invoice no?

I don't know what this code is supposed to do

        $invoice->products($request->input('tab'));

If you want to save multiple records at once you need to call saveMany

so it would be

$products = [
Product::create(['field' => $value1]),
Product::create(['field' => $value2])
];

$invoice->products()->saveMany($products);

http://laravel.com/docs/4.2/eloquent#inserting-related-models

0

Solved! thanks a lot!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

ocraton ocraton Joined 18 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.