"trim() expects parameter 1 to be string, object given",
Closed this issue · 1 comments
makobongo commented
Error when passing a function as part of the filter parameters:
"trim() expects parameter 1 to be string, object given",
on file:
vendor/agog/osmose/src/Library/Services/Sift.php line 24;
'payment_state' => function ($value, $query) { if($value === 'paid') { return $query->whereHas('payments'); } else if($value === 'unpaid') { return $query->whereDoesntHave('payments'); } }
franciskisiara commented
Hey @makobongo. Apologies for the delayed response, I must've missed the notification.
Given the code sample you have provided, you seem to have interchanged the function arguments. The query builder comes first, then the value.