/** * Store a newly created resource in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Beds::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $bed = new Beds(); // $ward = new Wards(); $ward = Wards::find(Input::get('ward')); $bed->ward_id = $ward->id; // $bed->save(); $bed->ward_type = \Illuminate\Support\Facades\Input::get('type'); // $bed->Ward_id = Input::get('ward'); // $bed->save(); $bed->bed_no = Input::get('bedno'); // $bed->save(); $bed->status = 'active'; // $bed->status= \Illuminate\Support\Facades\Input::get('status'); $bed->save(); return Redirect::route('adminipd.index'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy() { $id = $_GET['id']; $ward = Wards::find($id); $ward->delete(); return Redirect::route('wards.index'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Patient::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $patient = new Patient(); $ward = Wards::find(Input::get('ward')); // $patient->ward_id = $ward->id; $patient->ward_id = $ward->id; // $patient->save(); $patient->name = Input::get('name'); // $patient->save(); $patient->dob = Input::get('dob'); // $patient->save(); if (Input::has('email')) { $patient->email = Input::get('email'); // $patient->save(); } else { $patient->email = 'N/A'; // $patient->save(); } $patient->gender = Input::get('gender'); // $patient->save(); $patient->age = Input::get('age'); // $patient->save(); $patient->city = Input::get('city'); // $patient->save(); $patient->country = Input::get('country'); // $patient->save(); $patient->address = Input::get('address'); // $patient->save(); // $patient->ward = Input::get('ward'); // $patient->save(); $patient->bed = Input::get('bed'); // $patient->save(); // $beds = Beds::find('status'); // $beds ='active'; // $beds->save(); // exit(); // $patient->$bedid ='active'; // $bedid->save(); $patient->status = 'IPD'; $patient->room = Input::get('room'); // $patient->save(); if (Input::get('phone') == '') { $patient->phone = 'N/A'; } else { $patient->phone = Input::get('phone'); } // $patient->save(); if (Input::get('cnic') == '') { $patient->cnic = 'N/A'; } else { $patient->cnic = Input::get('cnic'); } // $patient->save(); if (Input::get('note') == '') { $patient->note = 'N/A'; } else { $patient->note = Input::get('note'); } // $patient->save(); $patient->patient_id = "P0" . $patient->id; $patient->save(); \Illuminate\Support\Facades\DB::update("update beds set status='inactive' where id='{$patient->bed}'"); \Illuminate\Support\Facades\DB::update("update rooms set status='inactive' where id='{$patient->room}'"); echo "this is"; // if(Input::has('email')){ // $data = ['name' => Input::get('name')]; // Mail::queue('emails.patient_welcome', $data, function($message) // { // $message->to(Input::get('email'), Input::get('name'))->subject('Welcome to EMR!'); // }); // } // "agya"; // // return Redirect::to('ipd_patient'); }