whereDoesntHave() public method

Add a relationship count / exists condition to the query with where clauses.
public whereDoesntHave ( string $relation, Closure $callback = null ) : Builder | static
$relation string
$callback Closure
return Builder | static
Esempio n. 1
0
 /**
  * Add a relationship count condition to the query with where clauses.
  *
  * @param string $relation
  * @param \Closure|null $callback
  * @return \Illuminate\Database\Eloquent\Builder|static 
  * @static 
  */
 public static function whereDoesntHave($relation, $callback = null)
 {
     return \Illuminate\Database\Eloquent\Builder::whereDoesntHave($relation, $callback);
 }
 /**
  * @param \Illuminate\Database\Eloquent\Builder $query
  * @param string                                $locale
  *
  * @return \Illuminate\Database\Eloquent\Builder|static
  */
 public function scopeNotTranslatedIn(Builder $query, $locale = null)
 {
     $locale = $locale ?: $this->locale();
     return $query->whereDoesntHave('translations', function (Builder $q) use($locale) {
         $q->where($this->getLocaleKey(), '=', $locale);
     });
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public static function scopeWithoutTag(Builder $query, $tags, $type = 'slug')
 {
     $tags = (new static())->prepareTags($tags);
     return $query->whereDoesntHave('tags', function ($query) use($type, $tags) {
         $query->whereIn($type, $tags);
     });
 }
Esempio n. 4
0
 /**
  * アクティブな日誌がないか
  * @param Builder $query
  * @return Builder|static
  */
 public function scopeDoesntHaveActiveDiary(Builder $query)
 {
     return $query->whereDoesntHave('workDiaries', function ($query) {
         $query->where('archive', false);
     });
 }
Esempio n. 5
0
 /**
  * Groups with no players for a given season.
  */
 public function scopeWithoutActivePlayers(Builder $query, Season $season)
 {
     return $query->whereDoesntHave('players', function (Builder $q) use($season) {
         $q->active($season);
     });
 }
Esempio n. 6
0
 /**
  * {@inheritdoc}
  */
 public static function scopeWithoutAttach(Builder $query, $attaches, $type = 'filename')
 {
     $attaches = (new static())->prepareAttaches($attaches);
     return $query->whereDoesntHave('attaches', function ($query) use($type, $attaches) {
         $query->whereIn($type, $attaches);
     });
 }
Esempio n. 7
0
 /**
  * @param Builder $query
  *
  * @return Builder
  */
 public function scopeActive(Builder $query)
 {
     return $query->whereDoesntHave('order');
 }
Esempio n. 8
0
 public function scopeNotOnTeamSet(Builder $query, TeamSet $teamSet)
 {
     return $query->whereDoesntHave('teams', function (Builder $query) use($teamSet) {
         $query->where('teams.team_set_id', $teamSet->id);
     });
 }