protected function getRecursiveAncestry(Collection $all_results, $ids)
    {
        $all_results->merge($results = DB::table($this->hierarchyTable)->whereIn('term_id', $ids)->get());

        if (count($results)) {
            $this->getRecursiveAncestry($all_results, Arr::pluck($results, 'parent_id'));
        }
    }
protected function getRecursiveAncestry(Collection $all_results, $ids)
    {
        $all_results->merge($results = DB::table($this->hierarchyTable)->whereIn('term_id', $ids)->get());

        if (count($results)) {
            $this->getRecursiveAncestry($all_results, Arr::pluck($results, 'parent_id'));
        }
    }
protected function getRecursiveAncestry ( Collection $ all_results , $ ids ) { $ all_results -> merge ( $ results = DB :: table ( $ this -> hierarchyTable ) -> whereIn ( 'term_id' , $ ids ) -> get ( ) ) ; if ( count ( $ results ) ) { $ this -> getRecursiveAncestry ( $ all_results , Arr :: pluck ( $ results , 'parent_id' ) ) ; } }
Get the ancestry recursively

@param Collection $all_results
@param int[] $ids
Get the ancestry recursively