protected function setPayableAndRoundOff()
    {
        switch (config('cart_manager.round_off_to')) {
            case 0.05:
                // https://stackoverflow.com/a/1592379/3113599
                $this->payable = round($this->total * 2, 1) / 2;
                break;

            case 0.1:
                $this->payable = round($this->total, 1);
                break;

            case 0.5:
                // http://www.kavoir.com/2012/10/php-round-to-the-nearest-0-5-1-0-1-5-2-0-2-5-etc.html
                $this->payable = round($this->total * 2) / 2;
                break;

            case 1:
                $this->payable = round($this->total);
                break;

            default:
                $this->payable = $this->total;
        }

        $this->roundOff = round($this->payable - $this->total, 2);
    }
protected function setPayableAndRoundOff()
    {
        switch (config('cart_manager.round_off_to')) {
            case 0.05:
                // https://stackoverflow.com/a/1592379/3113599
                $this->payable = round($this->total * 2, 1) / 2;
                break;

            case 0.1:
                $this->payable = round($this->total, 1);
                break;

            case 0.5:
                // http://www.kavoir.com/2012/10/php-round-to-the-nearest-0-5-1-0-1-5-2-0-2-5-etc.html
                $this->payable = round($this->total * 2) / 2;
                break;

            case 1:
                $this->payable = round($this->total);
                break;

            default:
                $this->payable = $this->total;
        }

        $this->roundOff = round($this->payable - $this->total, 2);
    }
protected function setPayableAndRoundOff ( ) { switch ( config ( 'cart_manager.round_off_to' ) ) { case 0.05 : // https://stackoverflow.com/a/1592379/3113599 $ this -> payable = round ( $ this -> total * 2 , 1 ) / 2 ; break ; case 0.1 : $ this -> payable = round ( $ this -> total , 1 ) ; break ; case 0.5 : // http://www.kavoir.com/2012/10/php-round-to-the-nearest-0-5-1-0-1-5-2-0-2-5-etc.html $ this -> payable = round ( $ this -> total * 2 ) / 2 ; break ; case 1 : $ this -> payable = round ( $ this -> total ) ; break ; default : $ this -> payable = $ this -> total ; } $ this -> roundOff = round ( $ this -> payable - $ this -> total , 2 ) ; }
Sets the payable and round off amount of the cart.

@return void
Sets the payable and round off amount of the cart .