php - Laravel 5.3 Different Fields Per User Role Type how to implement this using polymorphism? -


title says all

for example

i want main laravel user model have different kinds of roles , every role

has different fields

example

user has role of employee

where role have different fields user

you don't need use polymorphism here. user model used laravel so, should keep similar data in model. create employee , other models. should add one one relation between user , other models.

class user extends model {      public function employee()     {         return $this->hasone('app\employee');     } } 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -