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

gettherefast's avatar

Allow edit database related to current user only

So, i have 3 tables.

users => contains login information
civil_registries => contains civil registry data
users_has_civil_registry => link between user and civil registry.

currently every user can edit any field inside civil_registries.

how can i make my system allow users A to only edit data in civil_registries for user A and disallow it to edit civil_registries for users B? is it possible to do?

i hope you understand what i mean. thank you.

0 likes
2 replies
nsvetozarevic's avatar
Level 4

You make models, set proper relations, then you can achive that with policies. here is a docs link

gettherefast's avatar

alright, I'd try that, gonna get back to you soon.

edit : it works as intended! thanks nikos!

1 like

Please or to participate in this conversation.