Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function create()
- {
- //
- $patients=Patient::all();
- $doctors=Doctor::all();
- return view('appointments/create')->with('patients',$patients)->with('doctors',$doctors);
- }
- public function store(Request $request)
- {
- //
- $appointment = new Appointment();
- $appointment->dateAndHour=$request['dateAndHour'];
- $appointment->state=$request['state'];
- $appointment->header=$request['header'];
- $appointment->description=$request['description'];
- $appointment->patient_id=$request['patient_id'];
- $appointment->doctor_id=$request['doctor_id'];
- $appointment->save();
- return Redirect::to('appointments');
- }
- <div class="form-group col-md-6">
- <label for="patient">ID Paciente</label>
- <select name="patient_id" id="exampleInputIDPatient1" class="form-control" required autofocus>
- @foreach($patients as $patient)
- <option value="{{ $patient->id }}">{{ $patient->id }}</option>
- @endforeach
- </select>
- </div>
- <div class="form-group col-md-6">
- <label for="doctor">ID Doctor</label>
- <select name="doctor_id" id="exampleInputIDDoctor1" class="form-control" required autofocus>
- @foreach($doctors as $doctor)
- <option value="{{ $doctor->id}}">{{ $doctor->id}}</option>
- @endforeach
- </select>
- </div>
- public function create()
- {
- //
- return view('patients/create');
- }
- public function store(Request $request)
- {
- //dd($request["DNI"]);
- //
- $data = new User();
- $data->email = $request['email'];
- $data->password = $request['password'];
- $data->name = $request['name'];
- $data->surnames = $request['surnames'];
- $data->phone= $request['phone'];
- $data->gender=$request['gender'];
- $data->admin= (bool)$request['admin'];
- $data->save();
- $patient = new Patient();
- $patient->DNI= $request['DNI'];
- $patient->birthdate= $request['birthdate'];
- $patient->address= $request['address'];
- $patient->nationality=$request['nationality'];
- $patient->user_id = $data->id;
- $patient->save();
- return Redirect::to('patients');
- }
- public function create()
- {
- //
- $specialities = Speciality::all();
- /*$selectedSpecialities = array();
- foreach($specialities as $speciality) {
- $selectedSpecialities[$speciality->id] = $speciality->name;*/
- return view('doctors/create')->with('specialities',$specialities);
- }
- public function store(Request $request)
- {
- //
- $user = new User();
- $user->email = $request['email'];
- $user->password = $request['password'];
- $user->name = $request['name'];
- $user->surnames = $request['surnames'];
- $user->phone= $request['phone'];
- $user->admin = (bool)$request['admin'];
- $user->gender=$request['gender'];
- $user->save();
- $doctor = new Doctor();
- $doctor->room= $request['room'];
- $doctor->user_id = $user->id;
- $doctor->speciality_id=$request['speciality_id'];
- $doctor->save();
- return Redirect::to('doctors');
- }
- $users=User:all();
Add Comment
Please, Sign In to add comment