I using Laravel 5.3 .this my query and I want in result array the 'children_rec' renamed to 'node'.
$boxes = Boxes::with('children_rec')
->whereNull('box_id')
->with('position')
->get()
->toJson(128);
UPDATE: Relation code:
public function child()
{
return $this
->hasMany('PTA_OIMS\Boxes', 'box_id');
}
public function children_rec()
{
return $this->child()
->with('children_rec')
->with('position');
}
thanks