Calculating Total Price from Repeater Data

Hey, everyone! I'm currently tackling a challenge with filament forms involving orders and products tables.

Here's the scoop: I'm using a repeater to select multiple products when creating an order, and the data gets saved in an order_items table. My Order model has a method items() for the relationship, all good so far.

Now, the tricky part is calculating a total_price for the order based on the sum of unit_price for all selected products multiplied by their respective quantities. I want to save this total_price in the orders table.

Although order_items are saving correctly, the total_price isn't making it to the database when saving the order to the orders table. Any tips on handling this or integrating repeater data with the relationship for accurate calculations? Thanks!
prob_1.jpg
prob_2.jpg
prob_3.jpg
Was this page helpful?