Add additional user data

Published 3 days ago by mdk999

I'd like to add additional user data (Gender, height, weight, age, etc). I know I can extend the user model and add additional fields but not sure this is the best place for this data. I will probably need to get this information when accessing $user (ie $user->height). Suggestions on doing this? Thanks.

burlresearch

This sounds like $user->health data from what you describe. So you could create a new model/migration/table to store these fields.

However, they seem to be in 1:1 relation to the User model, so without loss of generality, why bother? You may as well just store them directly on the User model, and php artisan migrate:refresh to rebuild the representation.

This way, you will be able to access all these user-properties, directly from the user-model, as you expect:

$user->gender
$user->height
...

Please sign in or create an account to participate in this conversation.