New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Excluding drafts from Entry::whereCollection

William Ratke March 30, 2020 by William Ratke

Is there a way to exclude items in a collection that are saved as drafts when using the Entry API? How would I modify the code below to only show projects that are published?

$projects = Entry::whereCollection('project');
Answered by Erin Dalzell!
>>>>>>> Answered <<<<<<<
5 Replies