In FilamentPHP, resources are associated with pages. By default, these pages are named using the format filament.resources.[RESOURCE_PLURAL_NAME].[PAGE_NAME]
. For instance, the index page of a ProductResource
would be filament.resources.products.index
.
To generate a URL, you can utilize the route
helper as follows:
route('filament.resources.products.index')
However, I would recommend using the approach preferred by FilamentPHP, which is:
ProductResource::getUrl('edit', ['record' => $record])
This ensures consistency with FilamentPHP's conventions.
Let's make an "Go To Product" action button with this:
Tables\Actions\Action::make('go_to_product')
->icon('heroicon-o-pencil-alt')
->url(fn (Model $record): string => ProductResource::getUrl('edit', ['record' => $record])),
This button will be redirect user to product's edit page.
Top comments (3)
Thank you very much for this post
You're welcome.
How do I do this in a --simple Resource??