/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $requester = Requester::findOrFail($id); $requester->delete(); return $id; }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $ot = Ot::find($id); $ot_detail = OtDetail::where('ot_id', $id)->get(); $report = Report::where('ot_id', $id)->get(); $requester = Requester::find($ot->requester_id); $ot->requester_id = $requester->name; if ($report[0]->user_id != 0) { $user = User::find($report[0]->user_id); $report[0]->user_id = $user->name; } else { $report[0]->user_id = "No ingresado"; } $report[0]->status = Report::$statuses[$report[0]->status]; if ($ot->group_id != 0) { $group = Group::find($ot->group_id); $ot->group_id = $group->name; } else { $ot->group_id = "No ingresado"; } if ($ot->car_id != 0) { $car = Car::find($ot->car_id); $ot->car_id = $car->name; } else { $ot->car_id = "No ingresado"; } if ($ot->driver_user_id != 0) { $driver = User::find($ot->driver_user_id); $ot->driver_user_id = $driver->name; } else { $ot->driver_user_id = "No ingresado"; } if ($ot_detail[0]->allowance_id != 0) { $allowance = Allowance::find($ot_detail[0]->allowance_id); $ot_detail[0]->allowance_id = $allowance->name; } else { $ot_detail[0]->allowance_id = "No ingresado"; } if ($ot->type == 1) { $ot->status = Ot::$statusesDt[$ot->status]; if ($ot_detail[0]->ingdt_user_id != 0) { $ingdt_user_id = User::find($ot_detail[0]->ingdt_user_id); $ot_detail[0]->ingdt_user_id = $ingdt_user_id->name; } else { $ot_detail[0]->ingdt_user_id = "No ingresado"; } if ($ot_detail[0]->ingdt_user_id != 0) { $ingdt_user_id = User::find($ot_detail[0]->ingdt_user_id); $ot_detail[0]->ingdt_user_id = $ingdt_user_id->name; } else { $ot_detail[0]->ingdt_user_id = "No ingresado"; } $ot_detail[0]->detail_type = Ot::$typeDt[$ot_detail[0]->detail_type]; } return json_encode(array('ot' => $ot, 'ot_detail' => $ot_detail, 'report' => $report)); }