mardi 4 septembre 2018

How to display the below json data based on the key value"type"

Find below the code:

   @foreach($paymentinvoice['items']['item']['0'] as $key => $invoice)
                        @if($key == 'description')
                            <td></td>
                        @endif
                        @if($key == 'amount')
            <td></td>
                            <td><i class="fa fa-inr"></i> </td>
                        @endif              

                    @endforeach

I need to display the data of description, but the array is received as 0,1,2,3. How to split the data with foreach loop.

Find below the json data :

                         [items] => Array
    (
        [item] => Array
            (
                [0] => Array
                    (
                        [id] => 1175
                        [type] => Hosting
                        [relid] => 857
                        [description] => Super Lite - udytfuy.com (04/09/2018 - 03/09/2021)
                        [amount] => 3924.00
                        [taxed] => 1
                    )

                [1] => Array
                    (
                        [id] => 1176
                        [type] => Hosting
                        [relid] => 858
                        [description] => Ultimate - jdsgcsgjcfshg.com (04/09/2018 - 03/09/2021)
                        [amount] => 14004.00
                        [taxed] => 0
                    )

                [2] => Array
                    (
                        [id] => 1177
                        [type] => DomainRegister
                        [relid] => 340
                        [description] => Domain Registration - jdsgcsgjcfshg.com - 1 Year/s (04/09/2018 - 03/09/2019)
                        [amount] => 637.70
                        [taxed] => 1
                    )

                [3] => Array
                    (
                        [id] => 1178
                        [type] => DomainRegister
                        [relid] => 339
                        [description] => Domain Registration - udytfuy.com - 1 Year/s (04/09/2018 - 03/09/2019)
                        [amount] => 637.70
                        [taxed] => 1
                    )

            )

    )

From the above json data i need to display the description and amount based on "type".



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2oEBWW6
via IFTTT

Aucun commentaire:

Enregistrer un commentaire