如何在Laravel中以加密格式增加数据

时间:2018-10-24 06:50:48

标签: laravel laravel-5 laravel-4

在json数据下查找:

我必须对添加的软件包数量应用折扣价,但是API会返回如下数据。

      stdClass Object
      ( 
       [d372356e79cae5872e8bcba4f2247537] => stdClass Object
        (
        [rowId] => d372356e79cae5872e8bcba4f2247537
        [id] => 528aFgyGJqMFAg393bSCsmv6kaGk54TuM7WdD2YR6t4Wo2gf32
        [name] => linux
        [quantity] => 1
        [price] => 1962
        [options] => stdClass Object
            (
                [package] => Super Lite
                [bicycle] => triennially
                [gid] => 1
                [type] => hosting
                [os] => 
                [fields_id] => 0
                [addons] => Array
                    (
                    )

                [addons_id] => Array
                    (
                    )

                [discount_code] => 
                [discount_price] => 
                [discount_percentage] => 
            )

        [tax] => 353.16
        [subtotal] => 1962
        [model] => 
        [created_at] => 1540360795
        [updated_at] => 1540360833
    )

[79ba998c997a61be569e1ca85ba46fad] => stdClass Object
    (
        [rowId] => 79ba998c997a61be569e1ca85ba46fad
        [id] => ZNHIYaAmCchvPyNdM9u68R9ldfEGkI77noG6LzZLqSFR5Q12Zf
        [name] => linux
        [quantity] => 1
        [price] => 3096
        [options] => stdClass Object
            (
                [package] => Super Lite
                [bicycle] => biennially
                [gid] => 1
                [type] => hosting
                [os] => 
                [fields_id] => 0
                [addons] => Array
                    (
                    )

                [addons_id] => Array
                    (
                    )

                [discount_code] => 
                [discount_price] => 
                [discount_percentage] => 
            )

        [tax] => 557.28
        [subtotal] => 3096
        [model] => 
        [created_at] => 1540360810
        [updated_at] => 1540360810
    )

根据以上数据,我需要为所有包裹添加折扣金额。但是我得到的数组是从行ID开始的。所以建议我一个增加rowId的解决方案,因为API以加密格式返回行ID。

0 个答案:

没有答案