How can I change emptystate with the tabs?

class ListMovies extends ListRecords
{
protected static string $resource = MovieResource::class;

public function getTabs(): array
{
return [
'all' => Tab::make()
->icon('heroicon-m-bars-arrow-down'),
'Favorites' => Tab::make()
->icon('heroicon-o-star')
->modifyQueryUsing(function (Builder $query) {
$userFavorites = Auth::user()->favorites ?? [];

return $query->whereIn('id', $userFavorites);
}),
'Downloaded' => Tab::make()
->icon('heroicon-m-folder-arrow-down'),
// ->modifyQueryUsing(fn (Builder $query) => $query->where('active', false)),
];
}
}
class ListMovies extends ListRecords
{
protected static string $resource = MovieResource::class;

public function getTabs(): array
{
return [
'all' => Tab::make()
->icon('heroicon-m-bars-arrow-down'),
'Favorites' => Tab::make()
->icon('heroicon-o-star')
->modifyQueryUsing(function (Builder $query) {
$userFavorites = Auth::user()->favorites ?? [];

return $query->whereIn('id', $userFavorites);
}),
'Downloaded' => Tab::make()
->icon('heroicon-m-folder-arrow-down'),
// ->modifyQueryUsing(fn (Builder $query) => $query->where('active', false)),
];
}
}
So if no records are found, how can I change the description for each different tab? Is it even possible?
1 Reply
Matthew
MatthewOP8mo ago
Solution:
use Livewire\Component as Livewire;

->emptyStateDescription(function (Livewire $livewire){
dd($livewire->activeTab);
})
use Livewire\Component as Livewire;

->emptyStateDescription(function (Livewire $livewire){
dd($livewire->activeTab);
})
But this is not mentioned in the Tables section in the docs. Should I make a PR for this?
Want results from more Discord servers?
Add your server