How to use different logos for the login and the sidebar ?

When I set brandLogo in config it applies the same logo. I'd like to use two versions of the brand logo with differents size : one for the login page and one for the sidebar. Any idea? Thanks
Solution:
You can pass a closure to the brandLogo so I guess you should be able to differentiate between login page and other pages using request/url
Jump to solution
8 Replies
Solution
Krzysztof
Krzysztof5mo ago
You can pass a closure to the brandLogo so I guess you should be able to differentiate between login page and other pages using request/url
gausoft
gausoftOP5mo ago
Oh yeah, something like that. Thanks
gausoft
gausoftOP5mo ago
It's working
Adam Holmes
Adam Holmes2mo ago
Hi @gausoft What was the code you used here? The attached file is a binary that I cannot view
403gtfo
403gtfo2mo ago
You can customize any of the filament views by copying them into your resources folder. For example I am messing with the login page here: You should be able to put different logos where ever you like via this method.
No description
awcodes
awcodes2mo ago
No need to override views. It’s generally not recommended. Just create a regular view and tell the panel where to find it with ->brandLogo(fn () => view('filament.admin.logo')) Then in the view you can do something like this:
@if (is_panel_auth_route())
@svg('icon-ccf-centered-white', 'h-12 w-auto lg:h-16 mb-6')
@else
@svg('icon-ccf-favicon', 'h-8 w-8')
@endif
@if (is_panel_auth_route())
@svg('icon-ccf-centered-white', 'h-12 w-auto lg:h-16 mb-6')
@else
@svg('icon-ccf-favicon', 'h-8 w-8')
@endif
My panel auth check looks like this. Tailor to your needs.
if (! function_exists('is_panel_auth_route')) {
function is_panel_auth_route(): bool
{
$authRoutes = [
'/login',
'/password-reset',
'/register',
'/email-verification',
];

return Str::of(Request::path())->contains($authRoutes);
}
}
if (! function_exists('is_panel_auth_route')) {
function is_panel_auth_route(): bool
{
$authRoutes = [
'/login',
'/password-reset',
'/register',
'/email-verification',
];

return Str::of(Request::path())->contains($authRoutes);
}
}
403gtfo
403gtfo2mo ago
Neat 🙂 TIL. In my case I am doing other dark magic muahahahaha
Adam Holmes
Adam Holmes2mo ago
Brill - thanks 🙂

Did you find this page helpful?