Open lucamago opened 2 years ago
Is there a way to filter the posts retrieving by excluding some authors/categories? Right now I'm doing a filter by published and scheduled posts, in a post_date range, and I need to exclude posts by some authors and/or categories.
CorcelPost::whereIn('post_status',array('publish','scheduled')) ->where([ ['post_date', '>=', $dateReportFrom->format('Y-m-d 00:00:01')], ['post_date', '<=', $dateReportTo->format('Y-m-d 23:59:59')] ]) ->orderBy('post_date', 'DESC') ->get(['ID','post_title','post_date','guid','post_status']);
Hi!
I think you can use whereNot.
Description:
Is there a way to filter the posts retrieving by excluding some authors/categories? Right now I'm doing a filter by published and scheduled posts, in a post_date range, and I need to exclude posts by some authors and/or categories.
CorcelPost::whereIn('post_status',array('publish','scheduled')) ->where([ ['post_date', '>=', $dateReportFrom->format('Y-m-d 00:00:01')], ['post_date', '<=', $dateReportTo->format('Y-m-d 23:59:59')] ]) ->orderBy('post_date', 'DESC') ->get(['ID','post_title','post_date','guid','post_status']);