/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $personalData = PersonalDetails::where('registration_id', '=', $id)->first(); $personalData->idproof_type = null; $personalData->user_idproof = null; if (file_exists($id . "/idProof")) { unlink($id . "/idProof"); } if ($personalData->save()) { return Response::json(array('status' => 'success', 'msg' => 'Data deleted successfully')); } return Response::json(array('status' => 'failure', 'msg' => 'Problem in deleting data')); }
public function getStudentPersonalInfo(Request $request) { $data = $request->all(); if (empty($data)) { return Response::json(array('status', 'Failure', 'msg', 'Please enter data')); } else { $result = PersonalDetails::where('registration_id', '=', $data['id'])->first(); if (empty($result)) { return Response::json(array('status' => "failure", "msg" => "No data is present")); } $userDetails = RegistrationDetails::find($data['id']); unset($result['id']); unset($result['registration_id']); unset($result['updated_at']); unset($result['created_at']); unset($result['read_only']); unset($result['user_photo']); unset($result['idproof_type']); unset($result['user_idproof']); if (isset($userDetails->user_email)) { $result['user_email'] = $userDetails->user_email; } if (isset($userDetails->phone_no)) { $result['phone_no'] = $userDetails->phone_no; } if (isset($userDetails->country)) { $result['country'] = $userDetails->country; } return Response::json(array('status' => 'success', 'msg' => $result)); } }