I am using Laravel, and I have a foreach function like this
$name = person::find(1);
foreach($name as $dbitems) {
$person->services()->updateOrCreate([
'service' => $dbitems->Name,
'time' => $dbitems->Time
'price' => $anotherarrayhere
]);
}
In the place of $anotherarrayhere, I want to get this array from the outside of foreach function.
$anotherarrayhere = $peopleserviceprice[]
How can I include the $anotherarrayhere variable in the above foreach function?