Multitenant : Issues persistFiltersInSession on

My User can have many companies , Imagine I have filament table with filter department . and my client filter on Company A . then he switch company to Company B . obviously because of persistFiltersInSession , department_id still in session where that department not exists on Company B . how should I handle this ? can I clear persistFilterinSession when user switch company ? I am using table inside livewire component
No description
3 Replies
khairulazmi_
khairulazmi_OP5mo ago
because different company will have different department so yeah ..
toeknee
toeknee5mo ago
Have you enabled multi-tenancy? But you can do this with the getStateUsing() and clear the state if $state isn't in the list I have done this before
khairulazmi_
khairulazmi_OP5mo ago
if (session()->has('tenant_id')) {
$builder->where($table.'.company_id', session()->get('tenant_id'));
}
if (session()->has('tenant_id')) {
$builder->where($table.'.company_id', session()->get('tenant_id'));
}
I do this on middleware .

Did you find this page helpful?