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

rics's avatar
Level 1

Weird dilemma

Hi there guy, i hope someone can bring some light to my thoughts,

Imagine you have a factory, and for that factory you need a system, that manages stock, stock materials, orders and the production line, with that i need to split the system in two parts, the management part (stocks, stock materials, orders) and in the production line

i can split it like this myapp.com/login myapp.com/management/ myapp.com/production/

My dilemma is, i would like to make only one login and use the same users table for both (management and production line), but then in some way redirect the user to management or production based on where (the device) they are logging in from, example:

If i reach the login in the office i redirect to the managment part. if i reach the login in the tablet on the production line i redirect to the production part.

I cant use roles for this because although normal workers can't user the managment part of the system, all administrators, can in fact go to the production line to do some work too.

So if i did a role based authorization, if the administrative were to login in the production line, he would be redirected to the managment part anyway and not the production part.

What the best solution for this?

Did i manage to explain myself right? if not i can try to explain better what i want

Thanks in advance for the help, i really need it

0 likes
7 replies
Snapey's avatar

build one system

Do you think that production does not need raw materials stock details? Or not update finished product stock levels. Or not share costs between cost of manufacturing and cost of sales.

If you don't understand the elements of ERP you are probably not best placed to create such a solution.

1 like
rics's avatar
Level 1

@Snapey That's what I want to do, but I need to separate, production from administrative stuff

I know they need that, I am not saying they won't have raw material stock details, or product stock levels, they will have it all, but displaying it in another way that is different and more helpful for them, maybe I didn't explain me in the best way.

There would be different layouts for the administrative workers and the production workers, so each place would have the data displayed in a more specific and focused way, in this scenario, we should have for example:

myapp.com (main part, administrative stuff) production.myapp.com (the production side with a specific layout for production)

I know I can maybe do 2 login's with different guards (i never used this before), using the same provider (one users table, since administratives can go to the production line too) but i was wondering if there would be another way to do this

Snapey's avatar

There would be different layouts for the administrative workers and the production workers,

So what? you can have different layout for every page if you want. As for creating multiple guards, why make life so hard for yourself?

Focus on roles and permissions, which you will definitely need and stop sweating about how to separate admin workers and production workers. They are all users with different rights and abilities

tim_s's avatar

Not sure if i understand your problem correct. Do you want different redirects based on the ip address of the device? If a user from production device logs in -> redirect to 'production.myapp.de/whatever' If a user from office device logs in -> redirect to 'admin.my-app.de/whatever' If that is the case, maybe something like this could help: https://stackoverflow.com/questions/46107915/redirect-to-dashboard-page-by-ip-address-with-auth (Did not test it)

Tray2's avatar

It should be one system, and it should be role based just like @snapey said.

I would create a menu that looks at the roles of the user and loads the appropriate entries.

  • Admin
    • Admin task 1
    • Admin tast 2
  • Production
    • Production task 1
    • Production task 2
Snapey's avatar

if you want to go in deep right from the outset, you can investigate one of the modular architecture approaches, but to be honest these are best suited where you want to allow different teams of developers to work on different sections of a product without too much conflict. It helps you organise your code but for a solo developer the benefit is massively reduced and offset by the learning curve.

Please or to participate in this conversation.