本文整理汇总了PHP中Illuminate\Database\Eloquent\Builder::whereDoesntHave方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::whereDoesntHave方法的具体用法?PHP Builder::whereDoesntHave怎么用?PHP Builder::whereDoesntHave使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Eloquent\Builder
的用法示例。
在下文中一共展示了Builder::whereDoesntHave方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: whereDoesntHave
/**
* 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);
}
示例2: scopeNotTranslatedIn
/**
* @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);
});
}
示例3: scopeWithoutTag
/**
* {@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);
});
}
示例4: scopeDoesntHaveActiveDiary
/**
* アクティブな日誌がないか
* @param Builder $query
* @return Builder|static
*/
public function scopeDoesntHaveActiveDiary(Builder $query)
{
return $query->whereDoesntHave('workDiaries', function ($query) {
$query->where('archive', false);
});
}
示例5: scopeWithoutActivePlayers
/**
* 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);
});
}
示例6: scopeWithoutAttach
/**
* {@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);
});
}
示例7: scopeActive
/**
* @param Builder $query
*
* @return Builder
*/
public function scopeActive(Builder $query)
{
return $query->whereDoesntHave('order');
}
示例8: scopeNotOnTeamSet
public function scopeNotOnTeamSet(Builder $query, TeamSet $teamSet)
{
return $query->whereDoesntHave('teams', function (Builder $query) use($teamSet) {
$query->where('teams.team_set_id', $teamSet->id);
});
}