Updated MachineController to replace 'line' with 'workGroupMaster' for accurate data retrieval to get all group and individual work center
This commit is contained in:
@@ -41,11 +41,11 @@ class MachineController extends Controller
|
||||
], 403);
|
||||
}
|
||||
|
||||
$machines = Machine::with('plant')->with('line')->orderBy('plant_id')->get();
|
||||
$machines = Machine::with('plant')->with('workGroupMaster')->orderBy('plant_id')->get();
|
||||
$machinesData = $machines->map(function($machine) {
|
||||
return [
|
||||
'plant_code' => $machine->plant ? (String)$machine->plant->code : "",
|
||||
'group_work_center' => $machine->line->group_work_center ?? "",
|
||||
'group_work_center' => $machine->workGroupMaster ? (String)$machine->workGroupMaster->name : "",
|
||||
'work_center' => $machine->work_center ?? "",
|
||||
];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user