> ## Documentation Index
> Fetch the complete documentation index at: https://filament-34a8cf01.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom resource pages

> [!WARNING]
>
> You are currently viewing the documentation for Filament 4.x, which is a previous version of Filament.
>
> Looking for the current stable version? Visit the [5.x documentation](https://filament-34a8cf01.mintlify.site/5.x/resources/custom-pages.md).

## Introduction

Filament allows you to create completely custom pages for resources. To create a new page, you can use:

```bash theme={"theme":"gruvbox-dark-hard"}
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 theme={"theme":"gruvbox-dark-hard"}
public static function getPages(): array
{
    return [
        // ...
        'sort' => Pages\SortUsers::route('/sort'),
    ];
}
```

> [!WARNING]
>
> 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](https://laravel.com/docs/routing#route-parameters) defined in the route's path will be available to the page class, in an identical way to [Livewire](https://livewire.laravel.com/docs/components#accessing-route-parameters).

Loading preview

![A custom resource page with a settings form](https://filament-34a8cf01.mintlify.site/docs/images/4.x/light/panels/resources/custom-page.jpg)

## Using a resource record

If you'd like to create a page that uses a record similar to the [Edit](https://filament-34a8cf01.mintlify.site/4.x/resources/editing-records.md) or [View](https://filament-34a8cf01.mintlify.site/4.x/resources/viewing-records.md) pages, you can use the `InteractsWithRecord` trait:

```php theme={"theme":"gruvbox-dark-hard"}
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 theme={"theme":"gruvbox-dark-hard"}
public static function getPages(): array
{
    return [
        // ...
        'manage' => Pages\ManageUser::route('/{record}/manage'),
    ];
}
```

[Edit this page on GitHub](https://github.com/filamentphp/filament/edit/4.x/docs/03-resources/12-custom-pages.md)

## Sponsored by

[Your logo here](https://github.com/sponsors/danharrin)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.