public function transform(Order $order)
    {
        foreach ($order->meta() as $key => $total) {
            $payload[$key] = $this->converter->convert($total);
        }

        $payload['products'] = [];

        foreach ($order->products() as $product) {
            $payload['products'][] = array_map(function ($value) {
                return $this->converter->convert($value);
            }, $product);
        }

        return json_encode($payload);
    }
public function transform(Order $order)
    {
        foreach ($order->meta() as $key => $total) {
            $payload[$key] = $this->converter->convert($total);
        }

        $payload['products'] = [];

        foreach ($order->products() as $product) {
            $payload['products'][] = array_map(function ($value) {
                return $this->converter->convert($value);
            }, $product);
        }

        return json_encode($payload);
    }
public function transform ( Order $ order ) { foreach ( $ order -> meta ( ) as $ key => $ total ) { $ payload [ $ key ] = $ this -> converter -> convert ( $ total ) ; } $ payload [ 'products' ] = [ ] ; foreach ( $ order -> products ( ) as $ product ) { $ payload [ 'products' ] [ ] = array_map ( function ( $ value ) { return $ this -> converter -> convert ( $ value ) ; } , $ product ) ; } return json_encode ( $ payload ) ; }
Transform the Order

@param Order $order
@return mixed
Transform the Order