Mismatch with expected Builder instance and documentation
The documentation states that a custom summarizer should have an instance of
Illuminate\Database\Query\Builder
passed in, but when I do that, I get the error: Argument #1 ($query) must be of type Illuminate\Database\Eloquent\Builder, Illuminate\Database\Query\Builder given
I need to customize a summarizer. Basically I store dollar amounts as absolute numbers in the DB, and I have a transaction_type field that indicates if it's positive or negative. I need the summarizer to handle that, so was thinking something like this:
But it seems no matter what kind of Builder instance I pass in to the using method, i get the same error.3 Replies
Can't get past this error. Even the simplest example following the documentation and providing the correct reference gives the error about the wrong builder instance.
Jon, were you ever able to solve this? I am running into the same issue after reviewing the docs. It may be related to the
using
method. To shortcut my investigation, could you provide any solution that worked for you?
I just renamed Eloquent\Builder as EloquentBuilder which was being used elsewhere in the class and it worked. Sorry for the intrusion on something so simple!
Also, not sure if this is the best way to handle your issue with absolute values, but I created local scopes for positive and negative. like then make simple reference in the summarizer.Hmm, I’ll have to try that, I couldn’t ever get past the issue, I just set it aside and figured maybe it would get resolved at some point
Love the scope idea, thanks for that!