php - Laravel 5 polymorphic relationship with foreign key -


tables:

roles

-id -role 

users

-id -role_id 

schools

-id (primary, foreign-references id on users)  -other attributes 

consultancies

-id (primary, foreign-references id on users)  -other attributes 

students

-id (primary, foreign-references id on users)  -other attributes 

school, consultancies , students specialization (or generalization?) of users.

in model class, trying establish polymorphic one-to-one relationship. seems straight forward if there had not been roles table , role_id in user table had been string: role.

but structure, how relationships work?


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -