Exemple #1
0
 /**
  * Add whereHas subquery on the mapped attribute relation.
  *
  * @param  \Sofa\Eloquence\Builder $query
  * @param  string $method
  * @param  \Sofa\Eloquence\ArgumentBag $args
  * @param  string $target
  * @param  string $column
  * @return \Sofa\Eloquence\Builder
  */
 protected function mappedHasQuery(Builder $query, $method, ArgumentBag $args, $target, $column)
 {
     $boolean = $this->getMappedBoolean($args);
     $operator = $this->getMappedOperator($method, $args);
     $args->set('column', $column);
     return $query->has($target, $operator, 1, $boolean, $this->getMappedWhereConstraint($method, $args))->with($target);
 }
Exemple #2
0
 /**
  * Add whereHas subquery on the meta attributes relation.
  *
  * @param  \Sofa\Eloquence\Builder $query
  * @param  string $method
  * @param  \Sofa\Eloquence\ArgumentBag $args
  * @return \Sofa\Eloquence\Builder
  */
 protected function metaHasQuery(Builder $query, $method, ArgumentBag $args)
 {
     $boolean = $this->getMetaBoolean($args);
     $operator = $this->getMetaOperator($method, $args);
     if (in_array($method, ['whereBetween', 'where'])) {
         $this->unbindNumerics($args);
     }
     return $query->has('metaAttributes', $operator, 1, $boolean, $this->getMetaWhereConstraint($method, $args))->with('metaAttributes');
 }