sleiman.sleiman's avatar

Best practice UsersController AuthController

I m having some doubts about where to place actions when it comes to users and authentication.

for instance in L5 you have login, forgot password, reset, and register in the AuthController. So where do you guys place update , remove, ban ...?

0 likes
3 replies
JarekTkaczyk's avatar
Level 53

@sleiman.sleiman You may group it by responsibility: Actions concerning CRUD in UsersController and actions concerning authentication layer in AuthController.

But take it as a suggestion, there are no strict rules and you're free to take your own path, that you find the easiest to follow.

Just mind that, if you go with RESTful resource controller UsersController, I would not consider ban, unban or other auth actions as Update in CRUD obviously.

1 like
davorminchorov's avatar

Those 3 would probably go to the UsersController. Ban can be in the AuthController too if it makes sense depending on how you see it. You should check out some of the Auth packages on github and see where they put it.

Please or to participate in this conversation.