F
Filament16mo ago
Mark

Rendering a component before the user menu on the header

I don't know what I did wrong here, but I created a ServiceProvider that does the folliwing in the boot() method:
Filament::registerRenderHook(
'user-menu.start',
static fn (): string => Blade::render("<x-team-switcher>")
);
Filament::registerRenderHook(
'user-menu.start',
static fn (): string => Blade::render("<x-team-switcher>")
);
The components are standard components that were created through php arsisan make:component TeamSwitcher
7 Replies
Thijmen
Thijmen16mo ago
Code looks good. I see no static in docs so think you should remove that. So best guess is your component is not found
Mark
MarkOP16mo ago
That's a thought.
Patrick Boivin
Patrick Boivin16mo ago
Not 100% sure but I think static fn () just means you can't access $this inside of the closure, like a static method. Did you forget to close the tag? <x-team-switcher />
Mark
MarkOP16mo ago
I sure did. didn't make much of a difference though.
Thijmen
Thijmen16mo ago
Did you try with @livewire like in the docs? Or try returning a view()
Mark
MarkOP16mo ago
I ended up upgrading to Filament V3 as part of the solution. I'll take a further look at it once the upgrade is done.
Andrew Wallo
Andrew Wallo16mo ago
Yeah I had a custom banner that worked in v2 and now it doesn't work in v3.
Want results from more Discord servers?
Add your server