I'm not sure I fully understand you, but I think you're looking for Polymorphic Relations
Create Model which related to column name
hi, sorry for wrong title. I have a users table which it contains 3 type of users [teachers, managers , students]. what I need to do is to create , 3 model classes above names. when i need each of them, the model should first select the specific type then do the reset of the operation . like if i wanted to select all students from users table . i think it should be something like Student::get(); do you guys have any idea how is that gonna work for me ? thank you for any help .
You could also (maybe) use a global scope. So each model references the same table but use the scope to do something like where('account_type', 'student').
Please or to participate in this conversation.