src/Analyzers/TrafficAnalyzer.php
public function sortByField($field, $collection)
    {
        if ($collection->isEmpty()) {
            return 'N/A';
        }

        return $collection->groupBy($field)->sortByDesc(function ($logs) {
            return count($logs);
        })->first()->pluck($field)->first();
    }
public function sortByField($field, $collection)
    {
        if ($collection->isEmpty()) {
            return 'N/A';
        }

        return $collection->groupBy($field)->sortByDesc(function ($logs) {
            return count($logs);
        })->first()->pluck($field)->first();
    }
public function sortByField ( $ field , $ collection ) { if ( $ collection -> isEmpty ( ) ) { return 'N/A' ; } return $ collection -> groupBy ( $ field ) -> sortByDesc ( function ( $ logs ) { return count ( $ logs ) ; } ) -> first ( ) -> pluck ( $ field ) -> first ( ) ; }
Sort data by field

@param  string $field
@param  Collection $collection

@return Collection
Sort data by field