corcel / corcel

Use WordPress backend with Laravel or any PHP application
MIT License
4.62k stars 602 forks source link

Exclude authors/categories from post retrieving? #607

Open lucamago opened 2 years ago

lucamago commented 2 years ago

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']);

alexmanase commented 2 years ago

Hi!

I think you can use whereNot.