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

MomenMuhammad's avatar

Class Inheritance

Hello , i need to build an application for a university, i have multiple users type with different attributes, so i decided to make a user table which have the common attributes then a table for students and a table for staff , the problem is i want to be able to create a student without needing to create a user from the user model, i want to inherit the student model from the user model , how to do it and what is the best practice for something like this

0 likes
1 reply
jimmerioles's avatar

I'm having the same problem and searching for best suitable solution, i'm curious which approach would be best for this in laravel 5.2 but still minding for speed and maintainability/scalability:

a. Using multiple tables per type and utilizing polymorphic relations

b. Using multiple tables per type but using laravel5.2's multi-auth

c. or Single Table Inheritance

already seen other posts about this, hoping somebody with experience with different approach see this :)

Please or to participate in this conversation.