public function leaves() {
    $grammar = $this->getConnection()->getQueryGrammar();

    $rgtCol = $grammar->wrap($this->getQualifiedRightColumnName());
    $lftCol = $grammar->wrap($this->getQualifiedLeftColumnName());

    return $this->descendants()
                ->whereRaw($rgtCol . ' - ' . $lftCol . ' = 1');
  }
public function leaves() {
    $grammar = $this->getConnection()->getQueryGrammar();

    $rgtCol = $grammar->wrap($this->getQualifiedRightColumnName());
    $lftCol = $grammar->wrap($this->getQualifiedLeftColumnName());

    return $this->descendants()
                ->whereRaw($rgtCol . ' - ' . $lftCol . ' = 1');
  }
public function leaves ( ) { $ grammar = $ this -> getConnection ( ) -> getQueryGrammar ( ) ; $ rgtCol = $ grammar -> wrap ( $ this -> getQualifiedRightColumnName ( ) ) ; $ lftCol = $ grammar -> wrap ( $ this -> getQualifiedLeftColumnName ( ) ) ; return $ this -> descendants ( ) -> whereRaw ( $ rgtCol . ' - ' . $ lftCol . ' = 1' ) ; }
Instance scope targeting all of its nested children which do not have
children.

@return \Illuminate\Database\Query\Builder
Instance scope targeting all of its nested children which do not have children .