Skip to content

Customising the relation pages ​

The generated relation pages cover most needs. To change their title, their breadcrumbs or anything else a Filament page can do, write the page class yourself; the package then uses yours for that resource:

bash
php artisan make:filament-relation-navigator CustomerResource
php
class CustomerRelationPage extends RelationPage
{
    protected static string $resource = CustomerResource::class;

    protected static ?array $relations = ['orders', 'invoices'];  // only these
    protected static array $excludedRelations = ['notes'];         // never these
}
php
public static function getPages(): array
{
    return [
        'index' => ListCustomers::route('/'),
        'view' => ViewCustomer::route('/{record}'),
        ...CustomerRelationPage::relationRoutes(),
    ];
}

The class is a regular Filament page: override getTitle(), getBreadcrumbs(), getHeaderActions(), use your own traits, and so on.

Released under the MIT License.