map()
reduce()
return $this->reviewPhotosRepository
->getByHotelId($hotel_id)
->reduce(function ($carry, $item) {
$carry['notChecked'] += $item['checked'] ? 1 : 0;
$carry['published'] += $item['published'] ? 1 : 0;
$carry['total'] += 1;
return $carry;
}, [
'notChecked' => 0,
'published' => 0,
'total' => 0
]);