F
Filament11mo ago
Abi

How to get the Url for a Relation Manager

I am trying to customize the breadcrumb of a custom page and trying to redirect one of the breadcrumb item to a relation manager's view page. Any idea how I can get the route/url of the relation manger?
10 Replies
Abi
AbiOP11mo ago
any advice on this please
Tim van Heugten
Tim van Heugten11mo ago
Apologies I couldn’t reply within three hours. I’ll try to be faster next time. Where is the relation manager used? On a resource edit page? On a manage page? You can hit php artisan route:list and check out all the routes available.
Abi
AbiOP11mo ago
I am trying to get the Relation Manager URL from a Custom Resource page I created. https://filamentphp.com/docs/3.x/panels/resources/custom-pages
awcodes
awcodes11mo ago
CustomResouce::getUrl('key-of-page-rm-is-on', ['record' => $record])
CustomResouce::getUrl('key-of-page-rm-is-on', ['record' => $record])
basically though RMs don't have urls
Dennis Koch
Dennis Koch11mo ago
What Adam says. RM are components on a page.
Abi
AbiOP11mo ago
@awcodes what does 'key-of-page-rm-is-on' indicate? I have multiple RM's on my resource
Abi
AbiOP11mo ago
No description
awcodes
awcodes11mo ago
Relationship Managers don't have routes. They are part of a page. For example:
public static function getPages(): array
{
return [
'index' => MediaResource\ListMedia::route('/'),
'create' => MediaResource\CreateMedia::route('/create'),
'edit' => MediaResource\EditMedia::route('/{record}/edit'),
];
}

MediaResource::getUrl('edit', ['record' => $record]);
public static function getPages(): array
{
return [
'index' => MediaResource\ListMedia::route('/'),
'create' => MediaResource\CreateMedia::route('/create'),
'edit' => MediaResource\EditMedia::route('/{record}/edit'),
];
}

MediaResource::getUrl('edit', ['record' => $record]);
Abi
AbiOP11mo ago
So, there is no way to open the Resource page with a Specific RM tab open by default?
awcodes
awcodes11mo ago
I haven't done enough with the tabs to know for sure, but there might be a query string parameter that can be added for an activeTab. but the tabs are managed on the alpine side so there's not a way to really set it directly with php
Want results from more Discord servers?
Add your server