Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vildanhakanaj's avatar

Having Two Controller for the same resource

Hello everyone I have a question regarding best practices when it comes to controllers.

I have a Meeting model that a user can create when they book a meeting, also an admin can create a meeting for someone in the system. I have a MettingsController with a create and store method for creating a meeting but I use this for when a user books a meeting. Now when an admin creates a meeting I need to pass different inputs such as user id, type of security which for the user is set to a default value. I guess my question is: Is it better to have two controllers 1. MeetingController 2. AdminMeetingController so I don't clutter the MeetingController with if statements and checking what other fields I should add. What would be the best way in this type of case? I anticipate that in the future I will be adding more inputs for the admin side. I appreciate any suggestion or help that you guys will provide.

0 likes
2 replies
tykus's avatar

IMO, the cleanest approach is a separate controller either named AdminMeetingController, or (better in my opinion) a Admin\MeetingController. This allows you and other developers (including future you) to immediately understand the context for the intended action(s). In addition, it allows you to stick to CRUD actions in both controllers.

1 like
vildanhakanaj's avatar

Thank you for the reply. That's what my first thought was I just wasn't sure if this was the best way to go. Thanks for clarifying. :)

Please or to participate in this conversation.