Closed Timenator closed 5 years ago
If I understand right, you can add you own condition function, like:
$jsonq->macro('lengthLessThen', function ($value, $comparable) {
return count($value) < $comparable;
}
);
and then use it:
$jsonq->from('users')->where('name', 'lengthLessThen', 10)->get();
@nahid , correct if I am wrong, please.
It worked, thank you very much.
@Timenator you are welcome.
@GitHubHubus absolutely right. Thank you for your response
@nahid When you use the macro, is there also a possibility to somehow add sorting? maybe add a field?, in our case we calculate a distance, and I like to sort the results by that number.
the items with the shortest distance first.
Hello,
Can someone explain to me how the "macro" condition works. Or has someone an example?
With kind regards, Tim Nobbenhuis