public static function formatMoney($number, $locale = null, $internationalFormat = false, $format = true)
    {
        // When prices in cents needs to be formatted, divide by 100 to allow formatting in whole units
        if (config('laracart.prices_in_cents', false) === true && $format) {
            $number = $number / 100;
        // When prices in cents do not need to be formatted then cast to integer and round the price
        } elseif (config('laracart.prices_in_cents', false) === true && !$format) {
            $number = (int) round($number);
        } else {
            $number = number_format($number, 2, '.', '');
        }

        if ($format) {
            setlocale(LC_MONETARY, null);
            setlocale(LC_MONETARY, empty($locale) ? config('laracart.locale', 'en_US.UTF-8') : $locale);

            if (empty($internationalFormat) === true) {
                $internationalFormat = config('laracart.international_format', false);
            }

            $number = money_format($internationalFormat ? '%i' : '%n', $number);
        }

        return $number;
    }
public static function formatMoney($number, $locale = null, $internationalFormat = false, $format = true)
    {
        // When prices in cents needs to be formatted, divide by 100 to allow formatting in whole units
        if (config('laracart.prices_in_cents', false) === true && $format) {
            $number = $number / 100;
        // When prices in cents do not need to be formatted then cast to integer and round the price
        } elseif (config('laracart.prices_in_cents', false) === true && !$format) {
            $number = (int) round($number);
        } else {
            $number = number_format($number, 2, '.', '');
        }

        if ($format) {
            setlocale(LC_MONETARY, null);
            setlocale(LC_MONETARY, empty($locale) ? config('laracart.locale', 'en_US.UTF-8') : $locale);

            if (empty($internationalFormat) === true) {
                $internationalFormat = config('laracart.international_format', false);
            }

            $number = money_format($internationalFormat ? '%i' : '%n', $number);
        }

        return $number;
    }
public static function formatMoney ( $ number , $ locale = null , $ internationalFormat = false , $ format = true ) { // When prices in cents needs to be formatted, divide by 100 to allow formatting in whole units if ( config ( 'laracart.prices_in_cents' , false ) === true && $ format ) { $ number = $ number / 100 ; // When prices in cents do not need to be formatted then cast to integer and round the price } elseif ( config ( 'laracart.prices_in_cents' , false ) === true && ! $ format ) { $ number = ( int ) round ( $ number ) ; } else { $ number = number_format ( $ number , 2 , '.' , '' ) ; } if ( $ format ) { setlocale ( LC_MONETARY , null ) ; setlocale ( LC_MONETARY , empty ( $ locale ) ? config ( 'laracart.locale' , 'en_US.UTF-8' ) : $ locale ) ; if ( empty ( $ internationalFormat ) === true ) { $ internationalFormat = config ( 'laracart.international_format' , false ) ; } $ number = money_format ( $ internationalFormat ? '%i' : '%n' , $ number ) ; } return $ number ; }
Formats the number into a money format based on the locale and international formats.

@param $number
@param $locale
@param $internationalFormat
@param $format

@return string
Formats the number into a money format based on the locale and international formats .