Skip to content

Get Topics/Tags with published Posts only #1021

Discussion options

You must be logged in to vote

And as soon as I asked for help, I thought the following and it worked:

$tags = Tag::with(['posts' => function($q){
    $q->published();
}])->firstWhere('slug', $slug);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by austintoddj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant