I am trying to create a condition to check if all value in the array is 0. here's the example of the array.
array:4 [▼
0 => "0"
1 => "100"
2 => "200"
3 => "100"
]
here's the condition I am trying to fix
//update the status of the order
if(empty($input['remainingDeliveries'])) {
$order_idAcceptedItem = $acceptItem['order_id'];
$setStatus = \App\Orders::where('id', '=', $order_idAcceptedItem)->first();
if ($setStatus)
{
$setStatus->status_id = 3;
}
$setStatus->save();
The $input['remainingDeliveries'] carrying the array.
} else {
$order_idAcceptedItem = $acceptItem['order_id'];
$setStatus = \App\Orders::where('id', '=', $order_idAcceptedItem)->first();
if ($setStatus)
{
$setStatus->status_id = 4;
}
$setStatus->save();
}
at first, I thought my condition is ok but when I try to create a record with this array value,
array:4 [▼
0 => "152"
1 => "0"
2 => "0"
3 => "0"
]
it triggers the ELSE
what is the proper way to do it? thanks in advance!