# Articles

## Laravel 5 Collections: Calculating the Average Value of a Collection With average

Laravel 5 The average method is simply an alias of the avg method, and can be used in exactly the same way. Signature public function average( \$callback = null ); Example Use The following example demonstrates the...

## Laravel 5 Collections: Calculating the Average Value of a Collection With avg

Laravel 5 The avg method is a useful method for calculating the average of all items in the collection. The avg method defines an optional \$key parameter, which can be used to specify what property of the collection...

## Laravel 5 Collections: Calculating the Median Value of a Collection With median

Laravel 5 In mathematics, the median value is the numeric value that separates the higher half a data sample from the lower half; the median value does not necessarily exist within the data set itself. The median method...

## Laravel 5 Collections: Calculating the Minimum Value of a Collection With min

Laravel 5 The min method is the logical opposite of the max method, and accepts the same number of arguments. The min method can be used to retrieve the maximum value of the given \$key. By default, the \$key is null and...

## Laravel 5 Collections: Calculating the Sum of a Collection With sum

Laravel 5 The sum is a simple method that returns the sum of all items in a collection. It also defines a \$callback parameter which can be used to tell the sum method which values of the collection should be added...