F
Filament14mo 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
johny714mo 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
MRBUGOP14mo ago
thanks @johny7
Want results from more Discord servers?
Add your server