private function calculateLanguagesPercentage($referers)
    {
        $total = $referers->sum('count');

        return $referers->transform(function ($item) use ($total) {
            return $item + [
                'percentage' => round(($item['count'] / $total) * 100, 2)
            ];
        });
    }
private function calculateLanguagesPercentage($referers)
    {
        $total = $referers->sum('count');

        return $referers->transform(function ($item) use ($total) {
            return $item + [
                'percentage' => round(($item['count'] / $total) * 100, 2)
            ];
        });
    }
private function calculateLanguagesPercentage ( $ referers ) { $ total = $ referers -> sum ( 'count' ) ; return $ referers -> transform ( function ( $ item ) use ( $ total ) { return $ item + [ 'percentage' => round ( ( $ item [ 'count' ] / $ total ) * 100 , 2 ) ] ; } ) ; }
Calculate the referers percentage.

@param  \Illuminate\Support\Collection  $referers

@return \Illuminate\Support\Collection
Calculate the referers percentage .