F
Filament12mo ago
Saturn

Route to custom page

I have a table in the resource file where my last column is a view btn(basically an action). For now im using model to display the data. but what i want is to show on the custom page. I dont understant how to give action to the button in the column. if any documentation or tutorial is available plz do share.
1 Reply
jaocero
jaocero12mo ago
You need to register your custom page in your resource
public static function getPages(): array
{
return [
'index' => Pages\ManageOrganizations::route('/'),
'profile' => Pages\OrganizationProfile::route('/profile/{record}'),
];
}
public static function getPages(): array
{
return [
'index' => Pages\ManageOrganizations::route('/'),
'profile' => Pages\OrganizationProfile::route('/profile/{record}'),
];
}
and then you can just use that route generated in the route list. You can view the route list generate using php artisan route:list and use that route in your action:
->actions([
Tables\Actions\ActionGroup::make([
Tables\Actions\Action::make('view_profile')
->label('View Profile')
->icon('heroicon-o-building-office')
->url(fn (Company $record): string => route('filament.admin.resources.organizations.profile', $record->uuid)),
])
])
->actions([
Tables\Actions\ActionGroup::make([
Tables\Actions\Action::make('view_profile')
->label('View Profile')
->icon('heroicon-o-building-office')
->url(fn (Company $record): string => route('filament.admin.resources.organizations.profile', $record->uuid)),
])
])
Want results from more Discord servers?
Add your server