/**
  * @param \Notadd\Foundation\Database\Eloquent\Builder $query
  * @param \Notadd\Foundation\Database\Eloquent\Builder $parent
  * @return \Notadd\Foundation\Database\Eloquent\Builder
  */
 public function getRelationCountQueryForSelfRelation(Builder $query, Builder $parent)
 {
     $query->select(new Expression('count(*)'));
     $query->from($query->getModel()->getTable() . ' as ' . ($hash = $this->getRelationCountHash()));
     $key = $this->wrap($this->getQualifiedParentKeyName());
     return $query->where($hash . '.' . $this->getPlainForeignKey(), '=', new Expression($key));
 }