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

Atef95's avatar

Design registration system

Hey guys

I've an app that handles books rentals

The system is basically dedicated to students but it's accessible to guests too ..

I've 2 type of users

Normal user who access to frontoffice , pick up some products and order them..

Admin that has access to a backoffice to manage all data

for normal users :

I have fields like occupation / university / shipping details

My question

do I have to share access between them in one table and set the extra informations as null or create another table for admins ??

what's the best approach ??

0 likes
6 replies
rodrigo.pedra's avatar

I would keep it simple and have both on the same table. Add a column to differentiate if they are an admin or not, or use some permissions package like :https://github.com/spatie/laravel-permission/

But again, if there are only two roles (admin and regular) with no fine grained permissions between individual users, I would keep it simple and have just a column on the users table to differentiate the roles.

Having more users' tables and models for different roles requires a lot of extra configuration as adding custom guards and handling Policies files differently, It is worth when your project requirements requests complex handling of user roles, but for most app keeping them in the same table is much simpler and does the job.

1 like
Atef95's avatar

@rodrigo.pedra

Thank you for your clarifications :)

Because I was wondering if creating many nullable fields would be okay in the terms of optimization

STEREOH's avatar

What are those nullable fields you're talking about ? ( just for example )

Atef95's avatar

@stereoh

That's what I have at this moment

name of instituion( university)

occupation ( student,teacher..etc)

country

city

address

ID number

rodrigo.pedra's avatar

For these amount of fields I wouldn't worry too much about having so many nulls.

Does those columns are mostly different between roles (admin and regular)?

If not, each admin or regular user have the same columns, keep them in the same table.

If there are, you can breaking this into more tables while keeping the login info on the same users table. Similar to users and profiles approach where a user hasOne profile (hasOne indicates the relation between the tables). In your case a user would have one admin_profile or one regular_profile.

But again I would keep it simple for now. This amount of columns wouldn't have a noticeable impact on performance or storage until you have a huge amount of registered users.

If your app grows to that huge amount of users this will be a nice problem to solve and you sure will have the resources to do it. For now, my advice would be to keep it simple and focus on delivering the other features you already have requirements for.

1 like
jlrdw's avatar

Jeffrey has free videos on authorization which is where this logic belongs in authorization.

Authentication just means someone is logged in.

Authorization is what determines what a logged-in user can or cannot do.

Look at his laravel 6 from scratch series he has several authorization videos. Some real good instruction there.

I would advise to take the time and learn this stuff well.

1 like

Please or to participate in this conversation.