I want to update all supervisor IDs where employee_id and employee are equal. When i update this value it's just an update of the single value for WorkingHierarchys Table. I try too much but I can't resolve this.
here update only one value for employee
here updated code
foreach($supervisors as $key=>$supervisor){
$work_hiechye['supervisor_id']=$supervisor;
$work_hiechye['employee_id']=$employee;
WorkingHierarchy::where('employee_id',$employee)->update($work_hiechye);
}
You will need to update the employee_id where the superviser_id is equal with $superviser and it will be something like this. I don't know your whole context, but what are you trying to do is not gone work.
foreach($supervisors as $supervisor) {
WorkingHierarchy::where([ 'superviser_id' => $supervisor ])->update([ 'employee_id' => $employee ]);
}