我需要得到传入这个数组的数据但是我没有得到因为这个数组是这样的
array:2 [▼ // app\Http\Controllers\minhasVendasController.php:49
0 => array:1 [▼
"Order" => array:49 [▼
"status" => "PENDENTE"
"id" => "1325331"
"date" => "2023-03-03"
"customer_id" => "334011456"
"partial_total" => "79.90"
"taxes" => "0.00"
"discount" => "0.00"
"point_sale" => "PARTICULAR"
"shipment" => "FRETE GRÁTIS"
"shipment_value" => "0.00"
"shipment_date" => ""
"store_note" => ""
"discount_coupon" => ""
"payment_method_rate" => "0.00"
"value_1" => "0.00"
"payment_form" => ""
"sending_code" => ""
"session_id" => "b25bf4d07c0a4ec824032032bc"
"total" => "79.90"
"payment_date" => "0000-00-00"
"access_code" => "61DC48ABEFF95DF1325331"
"progressive_discount" => "0.00"
"shipping_progressive_discount" => "0.00"
"shipment_integrator" => ""
"modified" => "2023-03-04 16:21:24"
"printed" => ""
"interest" => "0.00"
"cart_additional_values_discount" => "0.00"
"cart_additional_values_increase" => "0.00"
"id_quotation" => ""
"estimated_delivery_date" => "2023-03-03"
"external_code" => ""
"tracking_url" => ""
"has_payment" => "0"
"has_shipment" => "0"
"has_invoice" => "0"
"total_comission_user" => "0.00"
"total_comission" => "0.00"
"is_traceable" => ""
"OrderStatus" => array:11 [▶]
"PickupLocation" => []
"ProductsSold" => array:1 [▶]
"Payment" => []
"OrderInvoice" => []
"MlOrder" => []
"OrderTransactions" => []
"MarketplaceOrder" => []
"Extensions" => []
"InvoiceIssuer" => array:2 [▶]
]
]
1 => array:1 [▼
"Order" => array:49 [▶]
]
]
我需要获取在此数组中传递的状态数据,但我没有得到它,因为数组是这样到达的
我的控制器
public function index()
{
$id = Auth::id();
$login_ok = DB::table('users')->where('id',$id)->first();
$id_tray = $login_ok->id_tray;
$consumer_key = env('consumer_key');
$consumer_secret = env('consumer_secret');
$code = env('code');
$api_address = env('api_address');
$acesso = Http::post($api_address.'/auth', [
'consumer_key' => $consumer_key,
'consumer_secret' => $consumer_secret,
'code' => $code
]);
$token = $acesso["access_token"];
$response = Http::get($api_address.'/orders', [
'access_token' => $token,
'partner_id' => $id_tray,
]);
$pedidos = $response["Orders"];
dd($pedidos);
//$criar = Http::get($api_address.'/orders?access_token='.$token&'access_token'=,);
return view('pages.minhas-vendas',compact('id','pedidos'));
}
我需要得到在这个数组中传递的数据但是我没有得到它因为数组是这样的,有人能帮我吗?
我的剑
<table id="example" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>Cliente</th>
<th>Sobrenome</th>
<th>Comissão</th>
<th>Status</th>
<th>Opções</th>
</tr>
</thead>
<tbody>
@foreach ($pedidos as $pedidos)
<tr>
<td>{{$pedidos['Order']}}}</td>
<td></td>
<td><a href="" target="_blank"></a></td>
</tr>
@endforeach
</tbody>
<tfoot>
</tfoot>
</table>
2条答案
按热度按时间pn9klfpd1#
尝试以下内容:
bqf10yzr2#
您有几个错误:
您正在将数组值赋给数组元素。
将其更改为:
此外,您正在使用
env
从. env文件中获取环境变量,您不应该在控制器、视图等上使用它。您应该使用config('service.value')
,并在. env文件中不存在env变量的情况下配置dev值。参考:www.example.comhttps://laravel.com/docs/10.x/configuration#accessing-configuration-values