F
Filament9mo ago
MRBUG

clickable widget with filter

currently I am in TeamResource here is the widget where i have 2 projects if i click this widget i will redirect to ProjectResource with these 2 projects filtered how can we archive this functionality more details: i have team_id in ProjectResource and in current widget I also have the current team_id. here is the widget code Stat::make('Total Project', Project::where('team_id', $teamId)->count())->url(ProjectResource::getUrl()) , currently, I am only redirecting to the Resource without a filter
No description
2 Replies
johny7
johny79mo ago
Add to your Stat::-Methods the following:
->extraAttributes([
'wire:click' => 'goToProject()'
])
->extraAttributes([
'wire:click' => 'goToProject()'
])
And in your WidgetClass define a new function:
function goToProject()
{
redirect(ProjectResource::getUrl());
}
function goToProject()
{
redirect(ProjectResource::getUrl());
}
MRBUG
MRBUG9mo ago
thanks @johny7