mercredi 18 décembre 2019

Read through JSON field and sum without foreach

I have the following Laravel collection:

$sum = $payments->where('status', 'Executed')->pluck('request_text')

request_text is a JSON field that has an amount property inside. Is there a way I can sum all that amount without looping through a json_decode with a foreach? Maybe some method equivalent to pluck but for extracting from JSON?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire