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

PHP while loop dynamic rowspan -

timer - Java TimerTask cancel -

android - How to read a column value in parse.com without accessing an object or a pointer -