i try to use array_add
method to add new element to array in for loop
public function getNotArray() {
// looping over $service Object
for($x = 0; $x < count($service);$x++) {
$firstService[$x] = $service[$x]->first_date_for_service;
while (Carbon::now() > $firstService[$x]) {
$firstService[$x]->addMinutes($service[$x]->notification_period);
if($firstService[$x] < Carbon::now() && $firstService[$x] > $service[$x]->serviceHistory->where('status','done')->max('created_at')) {
$arr[] = array_add($service[$x],'notificationDate',date($firstService[$x]));
}
}
}
return $arr;
}
The above script working well ,but return notificationDate
fixed value when loop over $arr
i need to get notificationDate
according for value that $firstService[$x]
carries in each loop
Any Suggestions,Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire