I think you should be able to do this by defining a single parameter (transaction_or_user_id
) and fetching the transaction in your index action and the user in your other actions. The issue becomes generating links, but if you create a link building callback for the route you can figure out which type of entity is passed in and pass in the parameter as expected.
It might be better to use a sub-name for users instead though.