mercredi 20 juin 2018

laravel 5.6 form doenot go to controller

index.blade

              <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=''></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=''></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=""></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>
                

controller 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');
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2K2pfRv
via IFTTT

Aucun commentaire:

Enregistrer un commentaire