/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { //$params = $request->all(); // Parameters to create the picture $image = $request->file('picture'); if (isset($image)) { $imageName = $image->getClientOriginalName(); $image->move(base_path() . '/public/images/catalog/', $imageName); // Creating the doctor $doctor = new Doctor(); $doctor->name = $request->get('name'); $doctor->lastname = $request->get('lastname'); $doctor->speciality = $request->get('speciality'); $doctor->experience_years_count = $request->get('experience_years_count'); $doctor->age = $request->get('age'); $doctor->picture = $imageName; $doctor->save(); // Redirecting to the doctor page if ($doctor->save()) { return redirect("doctors/" . $doctor->id)->withSuccess("Doctor successfully created!"); } else { return redirect()->back()->with('errors', "Error. Doctor can not be created."); } } return redirect()->back()->with('errors', "Error with parameters"); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { DB::beginTransaction(); $request['role'] = 'doctor'; $result = $this->register($request); $value = $result->getData(); if (property_exists($value, 'error')) { return $result; } else { $doctor = new Doctor(); $doctor['userId'] = $value->result->id; $doctor['contactNumber'] = $request->input('contactNumber'); $doctor['firstname'] = $request->input('firstname'); $doctor['lastname'] = $request->input('lastname'); try { $doctor->save(); } catch (\Exception $e) { DB::rollback(); return response()->json(['error' => ['message' => 'Error while saving Doctor', 'code' => 400]]); } DB::commit(); $finalResult['id'] = $value->result->id; $finalResult['token'] = $value->result->token; return response()->json(['result' => $finalResult]); } }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { $data = $request->except('_token'); $rules = ['name' => 'required', 'email' => 'email|unique:users,email|required', 'city' => 'required']; $message = ['required' => 'The :attribute field is required.', 'unique' => 'Existing Mail.']; $validator = Validator::make($data, $rules, $message); if ($validator->fails()) { $messages = $validator->messages(); return Redirect::route('doctor.create')->withErrors($validator)->withInput(); } $doctors = new Doctor(); $file = $data['filefield']; $extension = $file->getClientOriginalExtension(); $filename = $file->getFilename() . '.' . $extension; //Storage::disk('local')->put($file->getFilename().'.'.$extension, File::get($file)); $destination = 'images/'; $file->move($destination, $filename); $doctors->doctor_name = $data["name"]; $doctors->doctor_address = $data["address"]; $doctors->doctor_ph = $data['phone']; $doctors->doctor_email = $data['email']; $doctors->city_id = $data['city']; $doctors->degree = $data['degree']; $doctors->specialist = $data['special']; $doctors->mime = $file->getClientMimeType(); $doctors->photo = $file->getFilename() . '.' . $extension; $doctors->save(); $alldoc = DB::select(DB::raw("select doctors.*,cities.city_name from doctors inner join cities on doctors.city_id=cities.id ")); return View::make('doctors.all')->with(compact('alldoc')); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(DoctorRequest $request) { // $doctor = new Doctor($request->all()); $doctor->save(); return redirect('pis/doctor'); }
public static function storeDoctor($request) { $newLead = new Doctor(); $newLead->name = $request->get('name'); $newLead->field = $request->get('field'); $newLead->save(); return redirect()->back()->with('message', 'Doctor was successfuly saved'); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('doctors')->delete(); $doctor = new Doctor(['empId' => '2001', 'deptId' => '1', 'salary' => '90000']); $doctor->save(); $doctor = new Doctor(['empId' => '2002', 'deptId' => '1', 'salary' => '120000']); $doctor->save(); $doctor = new Doctor(['empId' => '2003', 'deptId' => '2', 'salary' => '85000']); $doctor->save(); $doctor = new Doctor(['empId' => '2004', 'deptId' => '3', 'salary' => '90000']); $doctor->save(); }
public function doctor_add(Request $request) { $newdoctor = new Doctor(); $newdoctor->doctor_name = $request->name; $newdoctor->department_id = $request->dep; $newdoctor->doctor_description = $request->detail; $newdoctor->doctor_level = $request->rank; $newdoctor->sex = $request->gender; //$newdoctor->worktime = $request->worktime; $newdoctor->save(); Session::flash('addmessage', '添加成功'); return view('admin/doctor/doctor'); }
public function store_data(DoctorFormRequest $request) { $doctor = new Doctor(array('dr_name' => $request->get('dr_name'), 'dr_id' => $request->get('dr_id'), 'designation' => $request->get('designation'), 'address' => $request->get('address'), 'phone_number' => $request->get('phone_number'), 'gender' => $request->get('gender'), 'about_dr' => $request->get('about_dr'))); $doctor->save(); return redirect(action('DoctorsController@edit_doctor', $doctor->dr_id))->with('status', 'Your Information has been inserted!'); }
public function getDoctorsInfoList(Request $request) { if (Auth::check()) { /* * Добавление врача в БД */ if ($request->has("add_doctor")) { $newDoc = new Doctor(); $newDoc->name = $request->input("new_doctor_name"); $newDoc->spec_id = $request->input("new_spec_id"); $newDoc->save(); } /* * Удаление врача из БД */ if ($request->has("del_doctor")) { $delDoc = Doctor::find($request->input("del_doctor_id")); $delDoc->delete(); } /* * Добавление специализации в БД */ if ($request->has("add_spec")) { $newSpec = new Specialization(); $newSpec->name = $request->input("new_spec_name"); //echo "true"; //exit; $newSpec->save(); } /* * Удаление специализации из БД */ if ($request->has("del_spec")) { /*echo "id"; echo $request->input("spec_list"); exit;*/ $delSpec = Specialization::find($request->input("spec_list")); $delSpec->delete(); } //$doctors = Doctor::paginate(15); $doctors = Doctor::paginate(15); $spec = Specialization::all(); $user = Auth::user(); $data["user_id"] = $user->id; $data["user_fullname"] = $user->fullname; /* foreach ($doctors as $doc){ print_r($doc->spec); }*/ //print_r($doctors); //exit; return view("doctors-list", ["doctors" => $doctors, "spec" => $spec, "data" => $data]); } }
/** * Adds a new Formal Docotr into the Doctors table. * * @return previous view */ public function insertNewFormal() { $input = Request::all(); $newDoctor = new Doctor(); $newDoctor->first_name = Request::get('fname'); $newDoctor->last_name = Request::get('lname'); $newDoctor->specialization = Request::get('spec'); $newDoctor->notes = Request::get('notes'); $newDoctor->profqual = Request::get('profqual'); $newDoctor->eduqual = Request::get('eduqual'); $newDoctor->hospital = Request::get('hospital'); $newDoctor->address = Request::get('address'); $newDoctor->city = Request::get('city'); $newDoctor->email = Request::get('email'); $newDoctor->phone = Request::get('phone'); $newDoctor->formal = 1; $newDoctor->save(); //$lastEntry = Doctor::orderBy('id', 'DESC')->first(); //$id = $lastEntry->id + 1; $id = $newDoctor->id; if (\Input::hasFile('image')) { $file = \Input::file('image'); $format = explode('.', $file->getClientOriginalName()); $file->move('uploads/profile_pics/doctors', $id . '.' . $format[sizeof($format) - 1]); $newDoctor->imagepath = 'uploads/profile_pics/doctors/' . $id . '.' . $format[sizeof($format) - 1]; } $newDoctor->save(); return redirect()->back(); }