mercredi 18 décembre 2019

Is there a way to pass query result from controller to a bootstrap model through a button click?Laravel 5.8

I want to get the Child name and Date of birth to my bootstrap model and edit it. I receive child data as an array, i want to show a single record.

**Here is my view **

  <!---Edit model-->
    <div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body">
            <form action=" "  method="post" id="xyzz">
           
     <div class="form-group">

       <label for="exampleInputEmail11">Child Name</label>
       <input type="text" class="form-control" id="m12"  placeholder="Enter child name" name="mchname" value="" >

     </div>
     <div class="form-group">
       <label for="exampleInputPassword1">Date of Birth</label>
       <input type="date" class="form-control" id="m13" placeholder=" " name="mdob"  value="" >
     </div>

     <button type="submit" class="btn btn-primary">Submit</button>
   </form>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> </button>

          </div>
        </div>
      </div>
    </div>

here is my controller

  public static function showChild(Request $csreq){


    $csid =$csreq->input('editc');

  $csdata=  DB::table('children')
    ->select('*')


    ->where('childid',[$csid])

    ->first();

    return view('moreDetails/edit',['csdata'=>$csdata]);

  }

I'm trying to pass child id through edit button to controller and then use it for the query, then i want to pass the query result to the bootstrap model Please help



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire