Why does it get a Builder; what are they relationships?
May 27, 2019
4
Level 13
collection (sum where)
I'm struggeling with the following callback on a collection $userProfile->givenFeedbacks:
$userProfile->givenFeedbacks->sum(function ($feedback) {
return count($feedback->where($feedback->shipping, null));
});
I'm trying to get the amount of entries in the collection where shipping is set to null using the callback of sum().
Currently I get:
count(): Parameter must be an array or an object that implements Countable
Please or to participate in this conversation.