Level 51
I would do something like user/{user_id}/role and a dedicated UserRoleController with basic rest actions similar in structure to Adam Wathans Cruddy by Design from Laracon 2017
4 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have two models in a many-to-many relationship, User and Role.
What is the best practice of defining the route (web) for the attach function when a User gets a new Role? The Post method is already used by the Create function in the route.
I would do something like user/{user_id}/role and a dedicated UserRoleController with basic rest actions similar in structure to Adam Wathans Cruddy by Design from Laracon 2017
Please or to participate in this conversation.