I have a collection of documents that look like this:
{
\"_id\" : ObjectId(\"5826182e2e94e0aefc541924\"),
\"calls\" : [
{
\"call_dat
You could use Laravel's Collection:
$collection = collect($arr['calls']);
And then, you can use the max
and min
methods with the relevant key as its argument:
$collection->max('call_date');
$collection->min('call_date');
But I am not sure this will work for date strings. If not, something like this should work:
$value = function($item) {
return strtotime($item['call_date']);
};
$collection->max($value);
$collection->min($value);