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

chrisgeary92's avatar

Database Schema for Users/Profiles

Hi Guys,

I have a questions about structuring an application that has various types of users. Basically the site I'm working on has 3 types of users.

  1. Student
  2. Teacher
  3. Agency

Each have a different set of form fields that will show on their public profile pages (it's a bit like a dating website, but matches students with private tutors).

The problem I have is the Agency user should be able to create multiple student/teachers. However these do not require email addresses, usernames or passwords (because they are not "real" users). But to everyone on the website, they would look like users.

I'm just not sure how to structure this. I was originally thinking about setting everything up as users with roles. Agencies would be a user type that had permission to create extra users (the problem here is that the created users do not need emails, usernames, passwords, reminder tokens, account activation etc). The

The next idea was to have a "profiles" table and allow users to only create 1 record in this table. Unless they are an Agency, in which case they can create multiple. This seems better, but something is telling me it's not right. It just seems a little messy.

I was wondering if anyone could point me in the right direction? Perhaps you've worked on something similar, or just have an idea of how I could do this? What DB tables I would need, what Models I would need etc.

Thank you :)

0 likes
1 reply
calebporzio's avatar
Level 7

Ok, I am doing something similar but I am not an experienced developer. Definitely get a pro opinion as well. But here's what I would do:

Models: - Users - Agency - Teacher - Student

In the Agency table I would have a field that references a user to create a one-to-one relation (user_id). Then for the others when they are added by the Agency, all that is added is their profile info. and no login info. If you need the created Teachers and Students to log in down the road, just create user entry and link them. This way you can avoid creating unused Auth entries.

I hope this makes sense and helps you. Again, relatively new to laravel and MVC, take it with a grain of salt.

2 likes

Please or to participate in this conversation.