public function toMachine(string $amount, string $swift_code = ''): int
    {
        $swift_code = empty($swift_code) ? config('currency.default_swift_code') : $swift_code;

        return (new DecimalMoneyParser(
                new ISOCurrencies()
            ))->parse(
                preg_replace('/[^0-9.-]/im', '', $amount),
                (new Currency($swift_code))
            )->getAmount();
    }
public function toMachine(string $amount, string $swift_code = ''): int
    {
        $swift_code = empty($swift_code) ? config('currency.default_swift_code') : $swift_code;

        return (new DecimalMoneyParser(
                new ISOCurrencies()
            ))->parse(
                preg_replace('/[^0-9.-]/im', '', $amount),
                (new Currency($swift_code))
            )->getAmount();
    }
public function toMachine ( string $ amount , string $ swift_code = '' ) : int { $ swift_code = empty ( $ swift_code ) ? config ( 'currency.default_swift_code' ) : $ swift_code ; return ( new DecimalMoneyParser ( new ISOCurrencies ( ) ) ) -> parse ( preg_replace ( '/[^0-9.-]/im' , '' , $ amount ) , ( new Currency ( $ swift_code ) ) ) -> getAmount ( ) ; }
Return to Database Format.
This method intended to be use before save to the database
and this need to be call manually.

@param string $amount
@param string $swift_code

@return int
Return to Database Format . This method intended to be use before save to the database and this need to be call manually .