Repeater rolls back after save
Hi all, I'm having a strange issue with the repeater field, after saving it rolls back the changes. But when I refresh the page or look at the database the changes are indeed saved. Never seen this before, any ideas?
Models: (nothing fancy)
Order, OrderItem.
Order hasMany OrderItem
OrderItem belongs to Order
Solution:Jump to solution
Ok, just an FYI for the future...
So i changed everything to use 'ClientOrder' instead of 'Order' now it works as expected. Not sure what the real problem was, but seems 'Order' can cause a conflict, at least in this scenario
🤷♂️...
6 Replies
I have other repeaters in other resources using these models "Product", "ProductVariant" and it works fine. Could it be that the name "Order" cannot be used? I have no idea what is going on...
Those fields are fillable?
yep, fillable and cast properly as well. Changes are saved to the database correctly, but the old value is returned after hitting save.
Like the old state is being used to fill the form, weird...
i'm now recreating the models but using different names "ClientOrder" instead of "Order". Maybe using "Order" somehow or somewhere causes an issue, never seen this problem before.
Hm. Sounds weird.
Solution
Ok, just an FYI for the future...
So i changed everything to use 'ClientOrder' instead of 'Order' now it works as expected. Not sure what the real problem was, but seems 'Order' can cause a conflict, at least in this scenario
🤷♂️
Ok, the problem was not with the naming, you can use "Order", the problem was with an accessor I had added. For some reason it messed up the repeater. So, for next time I need to be careful about accessors on models. Adding this comment for the future.