Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JohnJones123's avatar

How to Create Dependent Filters in Rappasoft Laravel Livewire Tables

I'm using the Rappasoft Laravel Livewire Tables package, and I need to create dependent filters. For example, when a user selects a category from the category filter, the subcategory filter should update and only show subcategories that belong to the selected category. How can I implement this kind of dynamic filtering where one filter's options depend on the selection of another?

1 like
2 replies
kevinbui's avatar

We also use Rappasoft Livewire Table. I have read the Rappasoft documentation. There's no straightforward ways to do so.

The best I can think of is using the Rappasoft\LaravelLivewireTables\Events\FilterApplied event. The following workaround might work:

  • Map that event to a listener.
  • In that listener, dispatch a different event to the Livewire table.
  • Adjust the filters.

Or you can submit a PR to improve the table.

ChandanShakya's avatar

Example you have two filter

  1. Shelf
  2. Shelf Compartment

Solution above worked

i tried using

// ->when($this->getAppliedFilterWithValue('shelf'), fn ($query) => $query->where('shelf_id', $this->getAppliedFilterWithValue('shelf')))

instead of

->when($this->shelfFilterValue, fn ($query) => $query->where('shelf_id', $this->shelfFilterValue))

but this crashed

Please or to participate in this conversation.