Guest User

Untitled

a guest
May 30th, 2018
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. public function create()
  2. {
  3. //
  4. $patients=Patient::all();
  5. $doctors=Doctor::all();
  6. return view('appointments/create')->with('patients',$patients)->with('doctors',$doctors);
  7. }
  8.  
  9. public function store(Request $request)
  10. {
  11. //
  12. $appointment = new Appointment();
  13. $appointment->dateAndHour=$request['dateAndHour'];
  14. $appointment->state=$request['state'];
  15. $appointment->header=$request['header'];
  16. $appointment->description=$request['description'];
  17. $appointment->patient_id=$request['patient_id'];
  18. $appointment->doctor_id=$request['doctor_id'];
  19. $appointment->save();
  20.  
  21. return Redirect::to('appointments');
  22. }
  23.  
  24. <div class="form-group col-md-6">
  25. <label for="patient">ID Paciente</label>
  26. <select name="patient_id" id="exampleInputIDPatient1" class="form-control" required autofocus>
  27. @foreach($patients as $patient)
  28. <option value="{{ $patient->id }}">{{ $patient->id }}</option>
  29. @endforeach
  30. </select>
  31.  
  32. </div>
  33.  
  34. <div class="form-group col-md-6">
  35. <label for="doctor">ID Doctor</label>
  36. <select name="doctor_id" id="exampleInputIDDoctor1" class="form-control" required autofocus>
  37. @foreach($doctors as $doctor)
  38. <option value="{{ $doctor->id}}">{{ $doctor->id}}</option>
  39. @endforeach
  40. </select>
  41. </div>
  42.  
  43. public function create()
  44. {
  45. //
  46.  
  47. return view('patients/create');
  48. }
  49.  
  50.  
  51.  
  52. public function store(Request $request)
  53. {
  54. //dd($request["DNI"]);
  55. //
  56. $data = new User();
  57.  
  58. $data->email = $request['email'];
  59. $data->password = $request['password'];
  60. $data->name = $request['name'];
  61. $data->surnames = $request['surnames'];
  62.  
  63. $data->phone= $request['phone'];
  64. $data->gender=$request['gender'];
  65. $data->admin= (bool)$request['admin'];
  66. $data->save();
  67.  
  68.  
  69.  
  70. $patient = new Patient();
  71.  
  72. $patient->DNI= $request['DNI'];
  73. $patient->birthdate= $request['birthdate'];
  74. $patient->address= $request['address'];
  75. $patient->nationality=$request['nationality'];
  76.  
  77. $patient->user_id = $data->id;
  78. $patient->save();
  79.  
  80. return Redirect::to('patients');
  81. }
  82.  
  83. public function create()
  84. {
  85. //
  86. $specialities = Speciality::all();
  87. /*$selectedSpecialities = array();
  88.  
  89. foreach($specialities as $speciality) {
  90. $selectedSpecialities[$speciality->id] = $speciality->name;*/
  91.  
  92. return view('doctors/create')->with('specialities',$specialities);
  93. }
  94. public function store(Request $request)
  95. {
  96. //
  97. $user = new User();
  98.  
  99. $user->email = $request['email'];
  100. $user->password = $request['password'];
  101. $user->name = $request['name'];
  102. $user->surnames = $request['surnames'];
  103.  
  104. $user->phone= $request['phone'];
  105. $user->admin = (bool)$request['admin'];
  106. $user->gender=$request['gender'];
  107. $user->save();
  108.  
  109. $doctor = new Doctor();
  110.  
  111. $doctor->room= $request['room'];
  112.  
  113.  
  114. $doctor->user_id = $user->id;
  115.  
  116.  
  117. $doctor->speciality_id=$request['speciality_id'];
  118. $doctor->save();
  119.  
  120. return Redirect::to('doctors');
  121. }
  122.  
  123. $users=User:all();
Add Comment
Please, Sign In to add comment