php - Laravel get array in blade with such 'bns:OrderId' names in it? -


i array external company handle in laravel application

the incoming json has names 'bns:orderid' in ?

blade give error when try access {{ $order->bns:orderid }}

how can handle this??

controller :

    public function getbolorders() {     // or live api: https://plazaapi.bol.com     $url = 'https://test-plazaapi.bol.com';     $uri = '/services/rest/orders/v1/open';      // public key     $public_key = '<public key>';      //your private key     $private_key = '<private key>';      $port = 443;     $contenttype = 'application/xml';     $date = gmdate('d, d m y h:i:s t');     $httpmethod = 'get';      $signature_string = $httpmethod . "\n\n";     $signature_string .= $contenttype . "\n";     $signature_string .= $date."\n";     $signature_string .= "x-bol-date:" . $date . "\n";     $signature_string .= $uri;     $signature = $public_key.':'.base64_encode(hash_hmac('sha256', $signature_string, $private_key, true));      // setup curl (one can opt use sockets or http libraries, curl versatile, widespread solution)     $ch = curl_init();     curl_setopt($ch, curlopt_httpheader, array("content-type: ".$contenttype, "x-bol-date:".$date, "x-bol-authorization: ".$signature));     curl_setopt($ch, curlopt_url, $url.$uri);     curl_setopt($ch, curlopt_returntransfer, true);     curl_setopt($ch, curlopt_port, $port);     curl_setopt($ch, curlopt_ssl_verifyhost, 0);     curl_setopt($ch, curlopt_ssl_verifypeer, 0);      $result = curl_exec($ch);     $orders = fopen("orders.xml", "w");     fwrite($orders, $result);     fclose($orders);     if(curl_errno($ch)) {        print_r(curl_errno($ch), true);     } // clean after ourselves     curl_close($ch); // convert xml json     $xmlnode = simplexml_load_file('orders.xml');     $arraydata = xmltoarray($xmlnode);     $openorder = $arraydata['openorders']['bns:openorder']; //    dd($openorder); // goto view     return view('bol.open-orders', compact('openorder')); } 

dd array :

array:2 [▼   0 => array:6 [▼    "bns:orderid" => "123"    "bns:datetimecustomer" => "2016-11-07t15:20:08.904"    "bns:datetimedropshipper" => "2016-11-07t15:20:08.904"    "bns:paid" => "true"    "bns:buyer" => array:2 [▶]    "bns:openorderitems" => array:1 [▶]  ]  1 => array:6 [▼    "bns:orderid" => "321"    "bns:datetimecustomer" => "2016-11-07t15:20:08.904"    "bns:datetimedropshipper" => "2016-11-07t15:20:08.904"    "bns:paid" => "false"    "bns:buyer" => array:2 [▶]    "bns:openorderitems" => array:1 [▶]    ] ] 

example blade template :

@foreach ($openorder $order)     {{ $order->bns:orderid }} @endforeach 

this query returns collection of arrays values not object. use {{ $order["bns:orderid"] }} instead of {{ $order->bns:orderid }}.

try this:

@foreach ($openorder $order)     {{ $order["bns:orderid"] }} @endforeach 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -