Since our Customer table can have thousands of entries - we need a way to filter them by something. In our case, we will create tabs to group them by their Pipeline Stage like this:

In this lesson, we will do the following:
- Dynamically create tabs for each Pipeline Stage
- Create a new tab called
Allto show all Customers - Add counters to each tab to show how many Customers are in each group
Let's get started!
Creating the Tabs
To make tabs, we will modify...
Thank you for the very useful tutorials. I have a question. How to control the visibility of a table column depending on the active tab?
I found a solution ->visible(fn ($livewire) => $livewire->activeTab !== 'all')
Get only the pipelines that have clients:
$pipelineStages = PipelineStage::whereHas('customers') ->orderBy('position') ->withCount('customers') ->get();I found this redundant :
Why?
This applies the
pipeline_stage_idfilter on the selected tab :) Without it - it wouldn't filter the records once you click, no?I think I've not understood what it does then because
is returning the correct customer count for each pipeline stage anyway.
So there's a few functions that this does. Especially if we are talking about tags:
->badge()just displays the amount of people with that status->modifyQueryUsing()allows you to click on the tab and filter records based on the filterThat way, you don't just get plain information, but also an additional filter on the table
Oh I see - this was new to me - thanks for the clarification.