/**
  * @param \Notadd\Foundation\Database\Eloquent\Builder $query
  * @param \Notadd\Foundation\Database\Eloquent\Builder $parent
  * @return \Notadd\Foundation\Database\Eloquent\Builder
  */
 public function getRelationCountQuery(Builder $query, Builder $parent)
 {
     if ($parent->getQuery()->from == $query->getQuery()->from) {
         return $this->getRelationCountQueryForSelfRelation($query, $parent);
     }
     return parent::getRelationCountQuery($query, $parent);
 }
 /**
  * @param \Notadd\Foundation\Database\Eloquent\Builder $query
  * @param \Notadd\Foundation\Database\Eloquent\Builder $parent
  * @return \Notadd\Foundation\Database\Eloquent\Builder
  */
 public function getRelationCountQuery(Builder $query, Builder $parent)
 {
     if ($parent->getQuery()->from == $query->getQuery()->from) {
         return $this->getRelationCountQueryForSelfRelation($query, $parent);
     }
     $query->select(new Expression('count(*)'));
     $otherKey = $this->wrap($query->getModel()->getTable() . '.' . $this->otherKey);
     return $query->where($this->getQualifiedForeignKey(), '=', new Expression($otherKey));
 }
Exemple #3
0
 /**
  * @return \Notadd\Foundation\Database\Query\Builder
  */
 public function getBaseQuery()
 {
     return $this->query->getQuery();
 }