Skip to content
Advertisement

Insert price to the pivot table

I am trying to insert data to a pivot table order_serrvice using arrays I follow this code: https://blog.quickadminpanel.com/master-detail-form-in-laravel-jquery-create-order-with-products/

the column qty and service was inserted properly but the price does not, I dont know why?

order_service table:

OrderController:

with dd($request):

dd($price[$service])

Data base outbut

Can any one help?

Advertisement

Answer

In your controller, you are misusing the attach() method:

The attach() method should be used like this:

The second parameter is an array with all additional pivot values.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement