本文整理汇总了PHP中Illuminate\Database\Eloquent\Builder::published方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::published方法的具体用法?PHP Builder::published怎么用?PHP Builder::published使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Eloquent\Builder
的用法示例。
在下文中一共展示了Builder::published方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apply
public function apply(Builder $builder, Model $model)
{
$builder->published();
$this->addWithDrafts($builder);
$this->addOnlyDrafts($builder);
$this->addOnlyRegistered($builder);
}
示例2: scopeRecent
/**
* Get $count most recent articles.
*
* @param Builder $query
* @param int $count
* @return Builder $query
*/
public function scopeRecent(Builder $query, $count)
{
return $query->published()->orderBy('published_at', 'DESC')->take($count);
}
示例3: publishedByIdOrAliasAndPid
public function publishedByIdOrAliasAndPid(Builder $query, $idOrAlias, $pid)
{
return $query->published()->idOrAlias($idOrAlias)->pid($pid);
}
示例4: scopeHasPublishedElement
/**
* get has a minimum one published child element of category
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $relation
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeHasPublishedElement($query, $relation)
{
return $query->has($relation, '>=', 1, 'and', function ($query) {
return $query->published();
});
}