MaZZie
MaZZie
FFilament
Created by ddoddsr on 12/14/2024 in #❓┊help
How Add a widget to relationManager form
Are you sure that you are in the boot() function? I had this when i had it in the mount().
7 replies
FFilament
Created by ddoddsr on 12/14/2024 in #❓┊help
How Add a widget to relationManager form
I use the PanelsRenderHook::RESOURCE_RELATION_MANAGER_BEFORE
trait RelationWidgets
{
public function boot(): void
{
$widget = str_replace('RelationManager', 'Widget', static::class);
FilamentView::registerRenderHook(
PanelsRenderHook::RESOURCE_RELATION_MANAGER_BEFORE,
fn (): string => \Blade::render('@livewire(\''.$widget.'\', ["resourceId" => $this->getOwnerRecord()->id])'),
);
}
}
trait RelationWidgets
{
public function boot(): void
{
$widget = str_replace('RelationManager', 'Widget', static::class);
FilamentView::registerRenderHook(
PanelsRenderHook::RESOURCE_RELATION_MANAGER_BEFORE,
fn (): string => \Blade::render('@livewire(\''.$widget.'\', ["resourceId" => $this->getOwnerRecord()->id])'),
);
}
}
The widget is living in app/Filament/Resources/{yourResource}/Widgets/ and has the name of your RelationManagerClass (if your RelationManager is HoursRelationManger than the widget should be HoursWidget)
7 replies