View Page Breaking Routes

I've just added an infolist to a resource to allow viewing of records, but it's breaking routes. I have sub-routes, so for example, Activities can have categories. The routing is: /activities /activities/categories I've fixed the issue by adding a suffix to the getPages:
'view' => ViewActivity::route('/{record}/view')
'view' => ViewActivity::route('/{record}/view')
Just wanted to check, is this the best approach or is there a better way?
5 Replies
Dennis Koch
Dennis Koch5mo ago
Make sure the categories route is defined before the view route and it should work.
Hightower
HightowerOP5mo ago
How would I go about that please?
Dennis Koch
Dennis Koch5mo ago
Move the route declaration to the right line. Can you show the full getPages() method?
Hightower
HightowerOP4mo ago
Oh, I've moved it right up to the top:
public static function getPages(): array
{
return [
'view' => ViewActivity::route('/{record}'),
'index' => ListActivities::route('/'),
'create' => CreateActivity::route('/create'),
'edit' => EditActivity::route('/{record}/edit'),
];
}
public static function getPages(): array
{
return [
'view' => ViewActivity::route('/{record}'),
'index' => ListActivities::route('/'),
'create' => CreateActivity::route('/create'),
'edit' => EditActivity::route('/{record}/edit'),
];
}
That seems to have worked, is that what you were pointing me to?
Dennis Koch
Dennis Koch4mo ago
Yeah. It needs to be aboe /create because otherwise it will look for a record with the ID "create"

Did you find this page helpful?