jonspalmer / single-table-inheritance

A Single Table Inheritance Trait for Eloquent/Laravel
MIT License
249 stars 50 forks source link

Update Readme #44

Closed lofye closed 6 years ago

lofye commented 6 years ago

Could you please include a note about how querying works? Do query builders return instances of the Child classes, or the table class? For example, if I have Car and Truck extending Vehicle, and I query the vehicles table, do I get back a 2 instance of Vehicle, or 1 Car and 1 Truck? Is there anything special we need to do when handling this? Not knowing the answer to this is making me not want to try this package... but I NEED this package.

jonspalmer commented 6 years ago

You get instances of the real classes. Pretty standard behavior of any single table inheritance pattern (in fact its mostly useless if you only get table classes). Please submit a PR with doc changes that you'd find useful.