store users in one table or multiple table Laravel [closed] - php

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 21 hours ago.
Improve this question
we are creating an e-learning website with Laravel, and we have multiple users (student, instructor, admin) should we store them in one table (users) or each user with own table.
I want to know if there is a convention

There is no set in stone rule, it is totally up to you. But from what I see in most Laravel projects, and what I do in my projects as well, to make it easier to read/troubleshoot you use a single "users" table and make a "profile" or "profile_type" column to determine which one are they attached to.

Related

PHP & MYSQL tables [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to figure it out this simple issue. I have two tables
1) Services
2) Projects
Some projects are using only one service_id (ex: web dev), but other are connected with two or three of them (ex: web dev, branding) and I have only one table call service_id. How can I add more than just one service_id?
Services
Projects
Like #ccKep wait, you need to create a table to link Services with Projects. So your database structure would look like:
You can then combine as many services to as many projects as you want. Projects_has_Services contains pairs of (service_id, project_id).

Relation between one table records [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I have a User table.Some Users have a manager which is a user too.
I need one to many relationship between users, but I don't want to create a new table for that.
I can use manager_id to relate users to their manager.
Now my question
Is it a right way to do some thing like that? If no, so what's the best way?
I'm using laravel and sqlite, relation is one to many
In the User table, you can add manager_id. This will create parent to child relationship. It will also support multiple hierarchies where managers can also have managers.
I have used this same model on categories which have sub categories.
This will work

How to create users like students and professors on MySQL? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm a newbie with PHP and MySQL. My project is about creating a website online on which I can put my school friend's grades and manage them. The problem is that I don't know how to separate users students/teachers.
I got an idea but still not clear. If in login page a make a radio button and add on it like this: "Student or Teacher". If they choose teacher I must test teacher's accounts to login in them to midify page.
You should look into the user/group/role pattern. You'll enter individuals into groups and assign roles to groups. You'll have to decide if you want one role per individual or many.

Keeping CMS history or not? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a database / systems question.
Say you have a CMS system done in PHP and Mysql
When you have users who edit their details, do you just update their row with the changes or do you keep a history for example by updating their row by setting the column 'status' = H (For History) and insert new row with all the old & new changed details with column 'status' = A (For Active) and that becomes the primary row?
I would just like to know what other developers do?
I'd keep a history for audit purposes but I'd move old records to a history table to prevent problems with primary ids. I wouldn't keep old records in the same table as current, that's just too much redundant data.

Database design for handling quiz site stats [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I need to create a quiz site and I'm not sure about how should I proceed with statistics. The site needs to track each users progress (which answer was answered how, how many time does it take to answer each question etc).
Should I create a new table (let's say 'statistics), and should I create a new row each time a user has finished a quiz? So, statistics:
user_id
quiz_id
answers (in serialized form, because the amount of questions is variable)
time_of_answer (same as above)
points_for_each_answer (same as above)
Wouldn't this be too slow, if the admin wants to check some stats, let's say: how many users have correctly answered the question #2 under the 3rd quiz?
Don't serialize answers if you need them as a real entity - just give them a quiz_id foreign key so you know to which quiz they belong, use proper indexes, and everything will run smooth.

Categories