Customising the relation pages
Title, subheading and breadcrumb of one relation
A relation manager can set them for its own page, from the record, with no page class:
php
class OrdersRelationManager extends RelationManager
{
public static function getRelationPageTitle(Model $ownerRecord): string|Htmlable|null
{
return "Orders of {$ownerRecord->name}";
}
public static function getRelationPageSubheading(Model $ownerRecord): string|Htmlable|null
{
return 'Last 12 months';
}
public static function getRelationPageBreadcrumb(Model $ownerRecord): ?string
{
return 'Orders';
}
}Return null to keep the default. A page class you wrote (below) wins with its own $title, $subheading and $breadcrumb. The menu and the tabs keep the relation manager's title. Relation groups have no relation manager, so their page uses the group label.
A page class of your own
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 CustomerResourcephp
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.