Can you explain a little bit more detailed what you try to achieve.
It seems you are inside your InvoicesController and try so save invoices to a order.
But how does your $invoices array get built? What is $result? What data is present inside your request and what should happen?
i am trying to save Invoices (field) which is from (another) Orders Table by way of syncing into Invoices Table, then the Invoice can be viewed by PDF mode to be downloaded.
when clicked sync button, only the new invoices will be saved, if invoices order_id exists in Invoices Table, it will not save.
the Orders Table is arrays, and Invoices also arrays, i try to check if Invoices will save the order_id which is only new.