Laravel eloquent orm - model inheritance -
i in team of developers going develop timetable application. there 2 entities instructor , student. student has id , firstname , lastname , class, email , phone number whereas instructor has id , firstname , lastname , subject, email , phone number. there common fields instructor , student. therefore have parent entity called users can include common fields id , firstname, lastname , email , phone number. , student class have student specific information such class, instructor have specific information such subject. dont know how in laravel couldnt find proper solution online. think common problem have. suggestions appreciated.
thanks
use object inheritance in php, user class extend eloquent , student class extends user, way student instances inherit user attributes being able define new attributes , functions students.
class user extends eloquent{ //id, firstname, lastname.. } class student extends user{ //class, instructor, .. }
Comments
Post a Comment