jarektkaczyk / eloquence-base

base for the Eloquence extensions + Searchable
https://softonsofa.com
MIT License
78 stars 71 forks source link

Call to undefined method Sofa\Eloquence\Query\Builder::orWhereHas() #40

Open marnickmenting opened 3 years ago

marnickmenting commented 3 years ago

Laravel 8.19.0 PHP 7.4.2 MySQL 5.7.26

I get an error when using a where subquery:

Ticket::where(function($query) {
            $query->whereHas('timeRegistrations', function ($query) {
                $query->whereNull('invoice_id');
            })->orWhereHas('usedProducts', function ($query) {
                $query->whereNull('invoice_id');
           });
})->get();

Results in Call to undefined method Sofa\Eloquence\Query\Builder::orWhereHas()

Without the subquery, the orWhereHas method works. Seems it is using the wrong Builder class within the subfunction, but I don't know where to start to investigate this.

Possibly related to https://github.com/jarektkaczyk/eloquence-base/issues/31.