Corcel\Post::newQuery PHP Method

newQuery() public method

Overriding newQuery() to the custom PostBuilder with some interesting methods.
public newQuery ( boolean $excludeDeleted = true ) : Corcel\PostBuilder
$excludeDeleted boolean
return Corcel\PostBuilder
    public function newQuery($excludeDeleted = true)
    {
        $builder = new PostBuilder($this->newBaseQueryBuilder());
        $builder->setModel($this)->with($this->with);
        // disabled the default orderBy because else Post::all()->orderBy(..)
        // is not working properly anymore.
        // $builder->orderBy('post_date', 'desc');
        if (isset($this->postType) and $this->postType) {
            $builder->type($this->postType);
        }
        if ($excludeDeleted and $this->softDelete) {
            $builder->whereNull($this->getQualifiedDeletedAtColumn());
        }
        return $builder;
    }