Last active
March 17, 2025 06:03
-
-
Save neverything/e1dda5018632e06aa5794179294b7e42 to your computer and use it in GitHub Desktop.
Filament persist table filters, sort and search per tenant: https://silvanhagen.com/writing/filament-persist-filters-tenant/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Filament\Traits; | |
use Filament\Facades\Filament; | |
trait HasTenantAwareSessionKeys | |
{ | |
public function getTableFiltersSessionKey(): string | |
{ | |
$table = md5($this::class.Filament::getTenant()); | |
return "tables.{$table}_filters"; | |
} | |
public function getTableSearchSessionKey(): string | |
{ | |
$table = md5($this::class.Filament::getTenant()); | |
return "tables.{$table}_search"; | |
} | |
public function getTableSortSessionKey(): string | |
{ | |
$table = md5($this::class.Filament::getTenant()); | |
return "tables.{$table}_sort"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment