php - Array element returning null in laravel-4 -
I am trying to get a record from a table using a given ID, and I want to assign a specific column to another array I want to store in, but I
my code:
$ getOrder = array (); Foreach (invoices as dollar orders in dollar orders) {$ getOrder [] = array (array ($ points within orders), array (order :: where ('id', '=', between dollar orders Are located in) -> (-) -> Inventory ('tracking_id')), array (order :: where ('id', '=', are located between dollar orders) - & gt; Get;) - & gt; Notifications ('Shipper_rf_now')); }
For those men, where $ ordersInWaypoint came, I received it from here:
$ ordersInWaypoint = array (); OrdersInWaypoint = Transaction :: where ('waypoint_id', "=", $ firstport) - & gt; Receive () - & gt; Lists ('order_id'); Ignore
$ firstWaypoint
, as it is determined by user input.
Every time I var_dump ($ getOrder);
I get the following result set:
array (size = 1) 0 = & gt; Array (size = 3) 0 = & gt; Array (size = 1) 0 = & gt; Int 637 = 1 & gt; Array (size = 1) 0 = & gt; Array (size = 1) ... 2 = & gt; Array (size = 1) 0 = & gt; Array (size = 1) ...
The first element is correct, but the rest brings the empty set back.
I think you are not getting any value because those order :: where ( ...)
returns strange objects, not just a value.
You can try better in this way:
$ getOrder = array (); Foreign exchange ($ $ in orders as $ drawings) $ order = order: where ('id', '=', $ order invoice) - & gt; get (); $ GetOrder [] = array (array order investor), array ($ order-> tracking_id), array ($ order-> shipping_reph_no)); }
let me know if it decides;)
edit
if you do not use multidimensional array only these three Values are required, so the final code is created:
$ getOrder = array (); Foreign exchange ($ $ in orders as $ drawings) $ order = order: where ('id', '=', $ order invoice) - & gt; get (); // $ GetOrder [] = Array to query query ($ commands andpoints, $ order-> Tracking_ID, // Call value object object calls as a method to order- Order-> Shipar_Ref_no / / Same (you can also call it as an array); // In that case you will type $ [[shipper_ref_no ']}
Comments
Post a Comment