Skip to content

Commit 7eee6fd

Browse files
committed
Merge branch 'master' of github.com:php-decimal/laravel
2 parents 800a86b + d10bda9 commit 7eee6fd

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
# Laravel integration for PHP Decimal
1+
# PHP Decimal: Laravel Integration
2+
3+
[![Packagist](https://img.shields.io/packagist/v/php-decimal/laravel.svg)](https://packagist.org/packages/php-decimal/laravel)
24

35
Provides:
46
- Trait for models to cast `Decimal` objects.
57
- Global helper functions.
68

9+
```bash
10+
composer require php-decimal/laravel
11+
```
12+

src/helpers.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function decimal($value, int $precision = Decimal::DEFAULT_PRECISION): Decimal
1717
}
1818
}
1919

20-
if (!function_exists("decimal")) {
20+
if (!function_exists("is_decimal")) {
2121
/**
2222
* @return bool TRUE if the given value is a decimal, FALSE otherwise.
2323
*/
@@ -27,7 +27,7 @@ function is_decimal($value): bool
2727
}
2828
}
2929

30-
if (!function_exists("decimal")) {
30+
if (!function_exists("decimal_sum")) {
3131
/**
3232
* @return \Decimal\Decimal The sum of all given values, calculated to $precision.
3333
*/
@@ -37,12 +37,12 @@ function decimal_sum($values, int $precision = Decimal::DEFAULT_PRECISION): Deci
3737
}
3838
}
3939

40-
if (!function_exists("decimal")) {
40+
if (!function_exists("decimal_avg")) {
4141
/**
4242
* @return \Decimal\Decimal The average of all given values, calculated to $precision.
4343
*/
4444
function decimal_avg($values, int $precision = Decimal::DEFAULT_PRECISION): Decimal
4545
{
46-
return Decimal::sum($values, $precision);
46+
return Decimal::avg($values, $precision);
4747
}
4848
}

0 commit comments

Comments
 (0)