code: public static function allLeaves() {
      $instance = new static;
  
      $grammar = $instance->getConnection()->getQueryGrammar();
  
      $rgtCol = $grammar->wrap($instance->getQualifiedRightColumnName());
      $lftCol = $grammar->wrap($instance->getQualifiedLeftColumnName());
  
      return $instance->newQuery()
                      ->whereRaw($rgtCol . ' - ' . $lftCol . ' = 1')
                      ->orderBy($instance->getQualifiedOrderColumnName());
    }
docs: Static query scope. Returns a query scope with all nodes which are at
  the end of a branch.
  
  @return \Illuminate\Database\Query\Builder