Guest User

Untitled

a guest
Jun 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. {{ Form::open(['action'=>'BookingsController@store', 'method'=>'POST']) }}
  2. <div class="form-row">
  3. <div class="form-group col-md-6">
  4. <select id="inputCategory" name="category" class="form-control">
  5. <option selected='selected' disabled='disabled'>Choose a Category</option>
  6. @foreach($categories as $category)
  7. <option value='{{$category->id}}'>{{$category->name}}</option>
  8. @endforeach
  9. </select>
  10. </div>
  11.  
  12. <div class="form-group col-md-6">
  13. <select id="inputService" name="service_id" class="form-control">
  14. <option selected='selected' disabled='disabled'>Choose a Service</option>
  15. @foreach($services as $service)
  16. <option value='{{$service->id}}'>{{$service->service_name}}</option>
  17. @endforeach
  18. </select>
  19. </div>
  20. </div>
  21.  
  22. <div class="form-row">
  23. <div class="form-group col-md-6">
  24. <select id="inputEmployee" class="form-control">
  25. <option selected='selected' disabled='disabled'>Choose an Employee</option>
  26. @foreach($vendors as $vendors)
  27. <option value="{{$vendors->id}}">{{$vendors->name}}</option>
  28. @endforeach
  29. </select>
  30. </div>
  31.  
  32. <div class="form-group col-md-6">
  33. <input type="date" name="date" class="form-control datepicker-input" id="datetimepicker5" data-toggle="datepicker" data-target="#datetimepicker5"/>
  34. </div>
  35. </div>
  36.  
  37. <div class="form-row">
  38. <div class="form-group col-md-6">
  39. <input type="text" name="location" class="form-control " placeholder="Enter your Address" >
  40.  
  41.  
  42. </div>
  43.  
  44. <div class="form-group col-md-6">
  45. <input type="text" name="contactAddress" class="form-control" placeholder="Enter your Phone number" >
  46.  
  47. </div>
  48. </div>
  49.  
  50. <div class="form-row">
  51. <button type="submit" class="btn bg-danger col mb-3 col-md-6 col-md-offset-3" >Submit</button>
  52. </div>
  53. {{ Form::close() }}
  54.  
  55. public function store(Request $request)
  56. {
  57. //return redirect('templets/partials/bookingforms/')->with('success','new Category added');
  58. $this->validate($request,[
  59. 'service_id' => 'required',
  60. 'date' => 'required',
  61. ]);
  62.  
  63. $booking = new Booking;
  64. $userBooking = new UserBooking;
  65.  
  66. $booking->date = $request->input('date');
  67. $booking->vendor_id = $request->input('vendor_id');
  68. $booking->location = $request->input('location');
  69. $booking->service_id = $request->input('service_id');
  70.  
  71. $booking->save();
  72.  
  73. $userBooking->booking_id = $booking->id;
  74. $userBooking->date = $request->input('date');
  75. $userBooking->save();
  76.  
  77. return redirect('templets/partials/bookingforms/')->with('success','new Category added');
  78. // return redirect('admin/booking/')->with('success','new Category added');
  79. }
Add Comment
Please, Sign In to add comment