Repeater Data in mutateFormDataBeforeCreate() method
I have a resource SalesOrderResource that implements a Repeater field (lines) to manage the sales order's line items. When the user clicks Create to add the model to the database I'm trying to modify some of the data before inserting it. In this case I would like to calculate the totals for the sales order by adding up the price for each line item. Easy enough, except that the $data parameter passed to the mutateFormDataBeforeCreate() method does not include the array of line items added via the repeater field, it only includes the fields for the sales order model. Am I going about this the right way? If so, what am I missing, if not, what is the best approach to calculate the order total before inserting it into the database?
Noting the block above, the $data['lines'] is not accessible. Here is the dump of what is included in the $data array.
0 Replies