Persist tab in InfoList when using getTabs function

How do I persist Tabs when using the getTabs() function in the List Resource? I see how in the docs when building up a Tab using ->persistTabInQueryString('settings-tab').
public function getTabs(): array
{
return [
'all' => Tab::make('All Talks'),
'submitted' => Tab::make('Submitted')
->modifyQueryUsing(function ($query) {
return $query->where('status', TalkStatus::SUBMITTED->value);
}),
'accepted' => Tab::make('Approved')
->modifyQueryUsing(function ($query) {
return $query->where('status', TalkStatus::APPROVED->value);
}),
'rejected' => Tab::make('Rejected')
->modifyQueryUsing(function ($query) {
return $query->where('status', TalkStatus::REJECTED->value);
}),
];
}
public function getTabs(): array
{
return [
'all' => Tab::make('All Talks'),
'submitted' => Tab::make('Submitted')
->modifyQueryUsing(function ($query) {
return $query->where('status', TalkStatus::SUBMITTED->value);
}),
'accepted' => Tab::make('Approved')
->modifyQueryUsing(function ($query) {
return $query->where('status', TalkStatus::APPROVED->value);
}),
'rejected' => Tab::make('Rejected')
->modifyQueryUsing(function ($query) {
return $query->where('status', TalkStatus::REJECTED->value);
}),
];
}
4 Replies
LeandroFerreira
add to your ListPage
public function mount(): void
{
parent::mount();
$this->activeTab = session('activeTab', $this->getDefaultActiveTab());
}

public function updatedActiveTab(): void
{
session(['activeTab' => $this->activeTab]);
}
public function mount(): void
{
parent::mount();
$this->activeTab = session('activeTab', $this->getDefaultActiveTab());
}

public function updatedActiveTab(): void
{
session(['activeTab' => $this->activeTab]);
}
Batman
BatmanOP4w ago
@LeandroFerreira Thank you!

Did you find this page helpful?