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

TobiasS's avatar
Level 10

Active deactivate user. Column or role

Hi!

I’m implementing the feature to active / deactivate users.

Two ways came to mind.

1 add a Boolean column to the User table 2 add the role and assign the users to active deactivated roles.

Any thoughts? Better ways?

Best regards, Tobias

0 likes
4 replies
Tray2's avatar
Tray2
Best Answer
Level 73

I think you are on the right track.

I would go with an active column on the users table.

When it comes to the roles I take it you have a many-to-many relationship, then I suggest adding the active to the role_user pivot table. Unless of course you activate and deactivate the role in the roles table.

TobiasS's avatar
Level 10

@Tray2 I thought of making a role “deactivated” and then add that role to the deactivated users

Tray2's avatar

@TobiasS It's the user that is deactivated not the role, so I say put it on the users table.

1 like

Please or to participate in this conversation.