Ability to find a panel programmatically

Hello, I'm pretty new to Filament, but I'm currently developing a multitenancy plugin for Laravel and I'm hoping somebody figure out how to achieve an integration between it and Filament. One of the things they want to do is feature lock panels, which I believe we can do with middleware. The other thing they want to do is customise the panel based on the current tenant. Things like the colour etc. Are there lifecycle events for panels? Or, is there a way that we could programatically locate a registered panel and change its settings once the current tenant is identified and set? I'm looking through the code and I can't find anything that fits, but there's a lot there. Would appreciate some guidance on this.
1 Reply
toeknee
toeknee4d ago
It depends what settings you want to change? I use this method to get the panels, then the panels that are accessible filtering.
ublic function panels(): array
{
$panels = FilamentFacade::getPanels();

// Remove non accessible panels
foreach ($panels as $k => $panel) {
if (! $this->canAccessPanel($panel)) {
unset($panels[$k]);
}
}

return $panels;
}
ublic function panels(): array
{
$panels = FilamentFacade::getPanels();

// Remove non accessible panels
foreach ($panels as $k => $panel) {
if (! $this->canAccessPanel($panel)) {
unset($panels[$k]);
}
}

return $panels;
}
Want results from more Discord servers?
Add your server