mardi 25 décembre 2018

How to access ' Json data in Laravel'

I am getting the server response in json format to my laravel controller. In my controller decoding the json data and passing to my view. In laravel blade i am unable to access data.

When i am printing total decoded result it is some thing like below.

I tried to access this by $result->shipping_address , $result['shipping_address']. But none of them worked.

Array
(
    [shipping_address] => Array
        (
            [entity_id] => 1
            [parent_id] => 4
            [customer_address_id] => 1
            [quote_address_id] => 4
            [region_id] => 564
            [customer_id] => 
            [fax] => 
            [region] => Telangana
            [postcode] => 500049
            [lastname] => Latname
            [street] => Road No 23
Deepthisree Nagar Madinaguda
            [city] => India
            [email] => asarush@xmial.com
            [telephone] => 9999999999
            [country_id] => IN
            [firstname] => Aakshay
            [address_type] => shipping
            [prefix] => 
            [middlename] => 
            [suffix] => 
            [company] => Aarush
            [vat_id] => 
            [vat_is_valid] => 
            [vat_request_id] => 
            [vat_request_date] => 
            [vat_request_success] => 
        )

)
Array
(
    [billing_address] => Array
        (
            [entity_id] => 2
            [parent_id] => 4
            [customer_address_id] => 1
            [quote_address_id] => 10
            [region_id] => 564
            [customer_id] => 
            [fax] => 
            [region] => Telangana
            [postcode] => 500076
            [lastname] => Gupta
            [street] => Road No 23
Golkonda
            [city] => Hyderabad
            [email] => fradnsss@gmail.com
            [telephone] => 9999999999
            [country_id] => IN
            [firstname] => Firsthan
            [address_type] => billing
            [prefix] => 
            [middlename] => 
            [suffix] => 
            [company] => Firstname
            [vat_id] => 
            [vat_is_valid] => 
            [vat_request_id] => 
            [vat_request_date] => 
            [vat_request_success] => 
        )

)
Array
(
    [vendor] => Array
        (
            [entity_id] => 1
            [entity_type_id] => 9
            [attribute_set_id] => 0
            [increment_id] => 000000009
            [parent_id] => 0
            [created_at] => 2018-10-01 11:09:32
            [updated_at] => 2018-11-27 12:55:57
            [is_active] => 1
            [website_id] => 1
            [address] => hyyderabad
            [city] => hyderabad
            [zip_code] => 500055
            [customer_id] => 1
            [shop_url] => cf97wksk
            [status] => approved
            [group] => general
            [public_name] => cf97wksk
            [name] => Firstname Lastname
            [email] => testemail@gmail.com
            [contact_number] => 9999999999
            [country_id] => IN
            [vendor_gstin] => 11PGTAU12346Q
            [gender] => 1
            [region_id] => 564
        )

)

I need to display shipping address and billing address in my view blade. How can i do that. I expect the out put like below

Shipping Address

Firstname Lastname Hyderabad Pin Code : 500072 Contact Number : 999888777



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2V6HoQG
via IFTTT

Aucun commentaire:

Enregistrer un commentaire