Updated MachineController to replace 'line' with 'workGroupMaster' for accurate data retrieval to get all group and individual work center

This commit is contained in:
dhanabalan
2025-09-15 14:42:26 +05:30
parent b48392a40c
commit d827c9368f

View File

@@ -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 ?? "",
];
});