Skip to main content
Glama
brianirish

Laravel 12 Docs MCP Server

by brianirish
panels-resources-custom-pages.md2.04 kB
# Filament - Panels/Resources/Custom Pages Source: https://filamentphp.com/docs/3.x/panels/resources/custom-pages #Overview --------- Filament allows you to create completely custom pages for resources. To create a new page, you can use: ```php php artisan make:filament-page SortUsers --resource=UserResource --type=custom ``` This command will create two files - a page class in the `/Pages` directory of your resource directory, and a view in the `/pages` directory of the resource views directory. You must register custom pages to a route in the static `getPages()` method of your resource: ```php public static function getPages(): array { return [ // ... 'sort' => Pages\SortUsers::route('/sort'), ]; } ``` > The order of pages registered in this method matters - any wildcard route segments that are defined before hard-coded ones will be matched by Laravel’s router first. Any parameters defined in the route’s path will be available to the page class, in an identical way to Livewire. #Using a resource record ------------------------ If you’d like to create a page that uses a record similar to the Edit or View pages, you can use the `InteractsWithRecord` trait: ```php use Filament\Resources\Pages\Page; use Filament\Resources\Pages\Concerns\InteractsWithRecord; class ManageUser extends Page { use InteractsWithRecord; public function mount(int | string $record): void { $this->record = $this->resolveRecord($record); } // ... } ``` The `mount()` method should resolve the record from the URL and store it in `$this->record`. You can access the record at any time using `$this->getRecord()` in the class or view. To add the record to the route as a parameter, you must define `{record}` in `getPages()`: ```php public static function getPages(): array { return [ // ... 'manage' => Pages\ManageUser::route('/{record}/manage'), ]; } ``` Edit on GitHub Still need help? Join our Discord community or open a GitHub discussion

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/brianirish/laravel-docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server