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

Don't have much time currently, but what you want is slightly tricky.

Take a look at the response on this page for how they make and save a relationship form. It would require some customization but should give you an idea.

http://stackoverflow.com/questions/20684932/nesting-models-relations-in-forms-laravel

0

Thanks a lot that almost solved my problem.

What I did different is that I introduced another column in the toppings table named array_key and stored the array key of the topping input fields for the respective service in it, otherwise using the id as array key don't seem to be a good idea for me.

For retrieving the toppings this helped me a lot

$topping = Service::find($service_id)->toppings()
                            ->where('array_key', $key)
                            ->first() ?: new Topping;
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Jimut jimut Joined 30 Mar 2016

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.