diff --git a/docs/02-resources.md b/docs/02-resources.md index 1050b9a9d0..71345e3cfe 100644 --- a/docs/02-resources.md +++ b/docs/02-resources.md @@ -337,6 +337,24 @@ To generate a URL for a resource route, you may call the static `generateUrl()` SortCustomers::generateUrl($parameters = [], $absolute = true); ``` +To access a custom page, such as a "show" route, from the table, you can define a new action: + +```php +use Filament\Resources\Tables\Table; +use Filament\Tables\RecordActions\Link; + +public static function table(Table $table) +{ + return $table + // ... + ->prependRecordActions([ + Link::make('view')->url(fn ($record) => static::generateUrl('show', ['record' => $record])), + ]); +} +``` + +By passing a callback to the `url()` method, you can get access to each row's record. + ## Authorization For authorization, Filament will observe any [model policies](https://laravel.com/docs/authorization#creating-policies) that are registered in your app. The `viewAny` action may be used to completely disable resources and remove them from the navigation menu.