corcel / corcel

Use WordPress backend with Laravel or any PHP application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exclude authors/categories from post retrieving?

lucamago opened this issue · comments

  • Corcel Version: 6.0.0
  • Framework Name & Version: Laravel 9
  • PHP Version: 8.1

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

Hi!

I think you can use whereNot.