How to redirect to Another resource module with tableFilters parameter .

I have "Area resource" now i wan to go "User resource" with User resource tableFilters thats mean i want to check how many user in this Area.
3 Replies
Vp
Vp12mo ago
This is my approach, hope you get the idea
// custom view
Tables\Columns\ViewColumn::make('lists_count')
->counts('lists')
->view('filament.tables.goto-list-page', [
'listUrl' => ListResource::getUrl(),
]),

// blade.php
<a
@class([
'text-primary-500 flex justify-center',
'underline' => $getState() > 0,
])
href="{{ $listUrl }}?tableFilters[category_id][value]={{ $getRecord()->id }}"
>
{{ $getState() > 0 ? $getState() : '-' }}
</a>
// custom view
Tables\Columns\ViewColumn::make('lists_count')
->counts('lists')
->view('filament.tables.goto-list-page', [
'listUrl' => ListResource::getUrl(),
]),

// blade.php
<a
@class([
'text-primary-500 flex justify-center',
'underline' => $getState() > 0,
])
href="{{ $listUrl }}?tableFilters[category_id][value]={{ $getRecord()->id }}"
>
{{ $getState() > 0 ? $getState() : '-' }}
</a>
Mir Dostogir Ahmed
Mir Dostogir AhmedOP12mo ago
@Vp i solved this way. This way is right ? Action::make('Packages') ->url(fn (Area $record): string => url(PackageResource::getUrl('index',['tableFilters[area_id][value]' => $record->id]))) ->icon('heroicon-m-rectangle-stack'),
Vp
Vp12mo ago
I cannot say whether it is correct or not, if it works for you then it's okay

Did you find this page helpful?