<?php

namespace App\Classes\General\Eloquent\Filters;


use Illuminate\Database\Eloquent\Builder;

class StatementTransactionOwnerInvoiceOrReceiptRefNotNull implements Filter
{

    /**
     * @param Builder $builder
     * @param $value
     * @return mixed
     */
    public static function apply(Builder $builder, $value)
    {
        return $builder->whereHas('owners', function ($query) {
            return $query->where(function ($q) {
                $q->orWhereNotNull('invoice_reference')->orWhereNotNull('receipt_reference');
            });
        });
    }
}
