Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {{ Form::open(['action'=>'BookingsController@store', 'method'=>'POST']) }}
- <div class="form-row">
- <div class="form-group col-md-6">
- <select id="inputCategory" name="category" class="form-control">
- <option selected='selected' disabled='disabled'>Choose a Category</option>
- @foreach($categories as $category)
- <option value='{{$category->id}}'>{{$category->name}}</option>
- @endforeach
- </select>
- </div>
- <div class="form-group col-md-6">
- <select id="inputService" name="service_id" class="form-control">
- <option selected='selected' disabled='disabled'>Choose a Service</option>
- @foreach($services as $service)
- <option value='{{$service->id}}'>{{$service->service_name}}</option>
- @endforeach
- </select>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-md-6">
- <select id="inputEmployee" class="form-control">
- <option selected='selected' disabled='disabled'>Choose an Employee</option>
- @foreach($vendors as $vendors)
- <option value="{{$vendors->id}}">{{$vendors->name}}</option>
- @endforeach
- </select>
- </div>
- <div class="form-group col-md-6">
- <input type="date" name="date" class="form-control datepicker-input" id="datetimepicker5" data-toggle="datepicker" data-target="#datetimepicker5"/>
- </div>
- </div>
- <div class="form-row">
- <div class="form-group col-md-6">
- <input type="text" name="location" class="form-control " placeholder="Enter your Address" >
- </div>
- <div class="form-group col-md-6">
- <input type="text" name="contactAddress" class="form-control" placeholder="Enter your Phone number" >
- </div>
- </div>
- <div class="form-row">
- <button type="submit" class="btn bg-danger col mb-3 col-md-6 col-md-offset-3" >Submit</button>
- </div>
- {{ Form::close() }}
- public function store(Request $request)
- {
- //return redirect('templets/partials/bookingforms/')->with('success','new Category added');
- $this->validate($request,[
- 'service_id' => 'required',
- 'date' => 'required',
- ]);
- $booking = new Booking;
- $userBooking = new UserBooking;
- $booking->date = $request->input('date');
- $booking->vendor_id = $request->input('vendor_id');
- $booking->location = $request->input('location');
- $booking->service_id = $request->input('service_id');
- $booking->save();
- $userBooking->booking_id = $booking->id;
- $userBooking->date = $request->input('date');
- $userBooking->save();
- return redirect('templets/partials/bookingforms/')->with('success','new Category added');
- // return redirect('admin/booking/')->with('success','new Category added');
- }
Add Comment
Please, Sign In to add comment