In this episode, we're tackling a feature that's been missing: the ability to actually see and restore items you've archived from your board! Up until now, you could archive cards and columns, but there was no way to view them or bring them back.
We kick things off by building a new modal, powered by Livewire, to display all the archived cards. We repurpose some code from the existing EditCard component to get started, then wire up a global dropdown in the board header so users can access the new "Archived Cards" menu item anytime.
Next, we make sure that we're actually fetching the right set of cards — specifically, ones that are archived. This involves adding an archived
scope to our Card model, and setting up a hasManyThrough
relationship on the Board model so we can grab cards through columns. With some fine-tuning, we ensure only cards themselves (not columns) are shown, and we order them by when they were archived so the most recent show up first.
Once the data is working, we style the modal for a nice scrollable list, handle the empty state gracefully, and add a button to "put back" archived cards onto the board. After confirming it all works for cards, we move on to do the exact same thing for columns: copy the functionality, tweak some code, and make sure archived columns show up in their own modal. We wrap up by making sure these new archived modals are easy to trigger from the UI and that all the model scopes are set up for both cards and columns.
By the end of the episode, we've got polished, user-friendly modals to view and restore both archived cards and columns — all fully integrated into our project's workflow. It's a big step towards a more complete and user-friendly board experience!