dimanche 11 avril 2021

How to show the checkbox data using modal bootstrap

i have created the form normally, but after I want to parse the data into index, there is data is not showed normally..

This a code for model Form

 protected $guarded = [];

    public function user(){
        return $this->hasOne('App\User', 'id', 'user_id'); //Product Model Name
    }

    public function location(){
        return $this->hasOne('App\Locations', 'id', 'location_id');
    }
    public function purpose(){
        return $this->hasOne('App\Purpose', 'id', 'purpose_id');
    }

    public function connection(){
        return $this->hasMany('App\FormConnection', 'id', 'form_connection'); //Product Model Name
    }

This a code for model FormConnection

    public function form(){
        return $this->belongsTo('App\Form', 'id', 'form_id'); //Product Model Name
    }

This is for Views of Modal

<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Form Information</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <p class="badge badge-pill badge-dark">Name: </p>
        <p>Purpose : </p>
        <p>Location : </p>
        <!-- <table class="table">
          <tbody>
              <tr>
              <th scope="row">Connection</th>
              <td><input type="checkbox" name="connection[]"  value="request">Request</td>
              <td><input type="checkbox" name="connection[]"  value="connection">Connection</td>
              </tr>
          </tbody>
        </table> -->
        @foreach()
        <div class="col-md-6 mt-2">
          <label for="">waw</label>
        </div>
        @endforeach
        <p>Division : </p>
      
      <div class="modal-footer">
        <button type="button" class="btn btn-primary" data-bs-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>

I Hope someone can help me, I really appreciate that:))

output: The connection should show all connection that has been checked before enter image description here




Aucun commentaire:

Enregistrer un commentaire