Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Http\Controllers;
  4. use App\Client as Client;
  5. use App\Room as Room;
  6. use App\Reservation as Reservation;
  7.  
  8. use Illuminate\Http\Request;
  9.  
  10. class ReservationsController extends Controller
  11. {
  12. //
  13. public function bookRoom($client_id, $room_id, $date_in, $date_out)
  14. {
  15. $reservation = new Reservation();
  16. $client_instance = new Client();
  17. $room_instance = new Room();
  18.  
  19. $client = $client_instance->find($client_id);
  20. $room = $room_instance->find($room_id);
  21. $reservation->$date_in = $date_in;
  22. $reservation->$date_out = $date_out;
  23.  
  24. $reservation->room()->associate($room);
  25. $reservation->client()->associate($client);
  26. $reservation->save();
  27.  
  28. return redirect()->route('clients');
  29. //return view('reservations/bookRoom');
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement