jeudi 10 juin 2021

Laravel Modal keeps on deleting the last id in the database

Hi Im trying to make a delete confirmation using modal in laravel in my users table. I noticed that the delete button is working but the delete button always deletes the last entry in the table and in the confirmation I put some <p>Are you sure you want to delete </p> but the name there is always from the last entry. here is my whole modal code

<!-- Delete Modal -->
  <div class="modal fade" id="userDelete"  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">Delete User</h5>
        </div>
        <div class="modal-body">
          <p>Are you sure you want to delete </p> 
        </div>
        <div class="modal-footer">
         {!!Form::open(['action' => ['UserController@destroy', $row->id], 'method' => 'POST','class'=>'pull-right'])!!}
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          
          
          {!!Form::close()!!}
        </div>
      </div>
    </div>
  </div>

How can I fix it?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire