F
Filament7mo ago
Tjiel

Looking for a way to change the logo based on the tenant.

Hey all, I am currently working on a project with multi tenancy, the tenant is based on the domain. As of now I have done the tenant styling using a middleware I made, here is the start of it:
public function handle(Request $request, Closure $next): Response
{
$tenant = tenant();

if ($tenant) {
if ($tenant->admin_primary_color) {
FilamentColor::register(['primary' => $tenant->admin_primary_color]);
}
public function handle(Request $request, Closure $next): Response
{
$tenant = tenant();

if ($tenant) {
if ($tenant->admin_primary_color) {
FilamentColor::register(['primary' => $tenant->admin_primary_color]);
}
This is working as intended but when I looked up on how to change the logo (preverably in a similar way), I could not find anything. So my question is if anyone knows how I might add functionality to my theming middleware, so I can update the logo using the tenants logo. Of course any recommendations for doing it outside the middleware are also welcome.
2 Replies
Dennis Koch
Dennis Koch7mo ago
You can get the current Panel via $panel = Filament::getPanel() and then modify the data as in your PanelProvider
Tjiel
TjielOP7mo ago
Thanks so much for the suggestion, although Filament::getPanel() did not work for my situation, Filament::getCurrentPanel() did work. I have added it the following way.
Filament::getCurrentPanel()->brandLogo($tenant->image);
Filament::getCurrentPanel()->brandLogo($tenant->image);
Want results from more Discord servers?
Add your server