Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0
  • Append homosapien's fields to a model that extends eloquent (es. Human) using protected $appends property, take a look at http://laravel.com/docs/eloquent#converting-to-arrays-or-json (last paragraph).
  • Specify custom getter relying on relation between homosapien's and man/woman (hasOne i think).
  • Men and Woman model should extend Human.
  • Using Men::find($id) or Woman::find($id) as usually you can access to the appended fields.

I can't test it at this moment, but should work.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.