private function getNodeModels($class, $relation_id)
    {
        if ($this->request->id === '0') {
            return is_null($relation_id)
                ? $class::all()->toHierarchy()
                : $class::where('parent_id',$relation_id)->get()->toHierarchy();
        }

        return $class::findOrFail($this->request->id)->descendants()->limitDepth(1)->get();
    }
private function getNodeModels($class, $relation_id)
    {
        if ($this->request->id === '0') {
            return is_null($relation_id)
                ? $class::all()->toHierarchy()
                : $class::where('parent_id',$relation_id)->get()->toHierarchy();
        }

        return $class::findOrFail($this->request->id)->descendants()->limitDepth(1)->get();
    }
private function getNodeModels ( $ class , $ relation_id ) { if ( $ this -> request -> id === '0' ) { return is_null ( $ relation_id ) ? $ class :: all ( ) -> toHierarchy ( ) : $ class :: where ( 'parent_id' , $ relation_id ) -> get ( ) -> toHierarchy ( ) ; } return $ class :: findOrFail ( $ this -> request -> id ) -> descendants ( ) -> limitDepth ( 1 ) -> get ( ) ; }
get node models

@param $class
@param integer $relation_id
@return \Illuminate\Database\Eloquent\Collection
get node models