Maybe you could store the order column as an array on the Quiz model instead of the Question model?
A nice RESTful way to bulk update 'order' on a pivot table , thoughts?
I have a Quiz model that has a belongsToMany relationship with another model called Question via a pivot table. Also stored on that pivot table is an 'order' column - which basically informs a controller/view which order to render on a page.
It's something i want my users to be able to update via the API so they can re-arrange the fields (and something i will be building a drag/drop interface for in my own front-end app).
I could use the update method on my resourceful controller to update each question with the new order - but that could result in 20-30 requests on a larger Quiz.
Does anyone have an opinion on the best way to perhaps bulk update this information in one request? i want to try and stay as RESTful as can be.
I know it's not a life-changing decision, but i'd like to know if there's a 'done' way of doing things like this.
Please or to participate in this conversation.