In this episode, we're taking our Kanban board to the next level by handling moved cards! By the end, you'll be able to sort cards both within their columns and move them between columns, making everything update smoothly behind the scenes.
First, we adjust how our cards are managed in code. Instead of working with plain arrays, we bring in the Laravel collection macros package, letting us use recursive collections for easier manipulation—super handy for iterating through columns and cards.
We walk through how to reorder cards inside a single column and update their order in the database. Then, we shift focus to cards that have been dragged to a different column. We log out the cards for each step so you can see exactly what's happening, then update their column IDs. We also cover common issues, like mass assignment errors, and show how to quickly fix them.
Finally, once everything's in place, we test moving cards all over the board—between columns and up and down within columns—and see the changes stick. By the end, your board will feel super interactive and reliable. If you're building anything with sortable lists in Laravel (or just a Kanban fan!), you won't want to miss this one.