Having the same issue. Hate to be the bringer of bad news but I have yet to find a solution.
Hi guys,
I've had some luck on this front. If you take a look at and follow this guide: http://www.colorfultyping.com/single-table-inheritance-in-laravel-4/
... That'll get you single-table-inheritance... Not what we want, but by adding the following to the BaseModel you can extend it:
private function augmentWithChildData($data, $table) {
$childData = DB::table($table)->where('id', $data->id)->first();
return (object) array_merge((array) $data, (array) $childData);
}
Then inside newFromBuilder(), add $attributes = $this->augmentWithChildData($attributes, $instance->mtiChildTable);
You've also need to explicitly set your base table: protected $table = 'user';
and don't override it in the children.
Finally, add this variable to each inheriting model: protected $mtiChildTable = 'manufacturer';
It's not the full solution, but hopefully it gets you most of the way there. -Trick
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community