public function show($id) { parent::$_data['am'] = ActionMain::find($id); parent::$_data['am_detail'] = ActionMainDetail::where("id_am", "=", $id)->get(); return view("action_maintenance.am_detail", parent::$_data); }
private function _service() { $service = ActionMain::all(); $res = []; foreach ($service as $item) { $detail_service = ActionMainDetail::where("id_am", "=", $item->id_actions)->get(); $det = []; foreach ($detail_service as $val) { $det[$val->id_am_detail] = $val->nama; } $res[$item->nama_action] = $det; } return $res; }