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

Randy_Johnson's avatar

Admin and User Login Pages

Hi, I was just wondering if it is better to have a login page for admin and a separate login page for standard users - or just to ultimately go through the same login system. With this said it would also be asked, is it better to have one database for admin and another for standard user?

Another question is should I have two separate common pages or should I just have one page with some if statements displaying different buttons.

Also, should I have a User and Admin controller for the same things, or should I just stick them in one common controllers.

0 likes
6 replies
ollie_123's avatar

Hey @randy_johnson

I think a lot of it comes down to personal preference & also what you're building along with how secure you need the system to be? If it was for an enterprise setup i would suggest separate login areas and separate user tables.

What are you looking to build? As this will determine most of the answers.

On my current project i'm using the same login form for both admin & users but where they are redirected to and what they have access to is dependant on what user level they are. depending on what you go for, the middleware & the auth files will handle most of the leg work & redirection once setup to how you want it.

Interms of the actual login system, i would suggest checking out "https://scotch.io/tutorials/simple-and-easy-laravel-login-authentication".

Out of the box most of the scaffolding is done by Laravel. from there you can adjust accordingly.

Once the login system has been built, i would suggest separate views & controllers for Admin / User retrospectively as it will be a lot cleaner, easier & scalable. As a general rule of thumb, i suggest using one controller per view page otherwise it all gets a bit messy & confusing when you come back to it later.

Randy_Johnson's avatar

404 bro on the url. I currently have a system like this and this is my file structure.

Controllers Admin - products - etc User - products - etc

The thing is, is products is the same thing but both products is different in that is serving two group's. To have one would have it too big. I think i just answered this one for myself but i would appreciate your inputs.

Going on to views i have the same lay out

Admin - products User - products

Both are technically the same but display different. Would it be best to have admin user displayed in one. I think not.

I think that splitting everything to the users need is the best way.

Ah like i say any input is welcome. I think this post is just really on how to organize.

ollie_123's avatar

@randy_johnson you could separate your controllers by admin & user by putting all of the admin controllers in an admin folder & vice versa i.e

/App
    /Admin (folder)
        -AdminDashboardController
        -AdminProductController
        -EtcController
    /Customer (folder)
        -CuDashboardController
        -CuProductController
        -CuEtcController

This way it keeps the logic separate and will be cleaner and more scalable.

Hope that makes sense. Let me know if you need any clarification on the example file tree ;).

Please or to participate in this conversation.