title: Laravel: DataTable Multiple checkboxes
body: <p>Im fetching my data in my server side and I put checkbox.</p>
  
  <p>I need some clarification, do I need to put checkbox here or it will be automatically added? </p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>$result[]  = array(
          '#'                     =&gt; '&lt;span style="font-size: 12px; color: gray"&gt;'.$counter++.'&lt;/span&gt;',
          'number'                =&gt; '&lt;p&gt;'.$value-&gt;number.'&lt;/p&gt;',
          'vendor'                =&gt;  '&lt;p&gt;'.$vendor-&gt;name .'&lt;/p&gt;',
          'document_reference'    =&gt; '&lt;p&gt;'.$value-&gt;document_reference.'&lt;/p&gt;',
          'date_needed'           =&gt; '&lt;p&gt;'.$value-&gt;date_needed.'&lt;/p&gt;',
          'requesting_department' =&gt; '&lt;p&gt;'.$department-&gt;name.'&lt;/p&gt;',
          'amount'                =&gt; '&lt;p align="right"&gt;'.number_format($value-&gt;total_amount,2).'&lt;/p&gt;',
          'status'                =&gt; '&lt;p&gt;'.$status.'&lt;/p&gt;',
          'approval_status'       =&gt; '&lt;p id="'.$value-&gt;id.'"&gt;'.$approval.'&lt;/p&gt;',
          'created_by'            =&gt; '&lt;p id="created_at'.$value-&gt;id.'"&gt;'.$user-&gt;name.'&lt;/p&gt;',
          'action'                =&gt; '&lt;a href="/requests/request-for-payment?id='.$value-&gt;id.'#view-request-for-payment-modal" class="btn btn-primary btn-sm" title="View"&gt;&lt;i class="fa fa-eye"&gt;&lt;/i&gt;&lt;/a&gt;',
          'checkbox'                 =&gt; '&lt;input type="checkbox" name="checkbox[]" value="'.$value-&gt;id.'"&gt;'
  </code></pre>
  
  <p>In my view page I used route to call this method. In here I have now my data.</p>
  
  <p><strong>My View</strong></p>
  
  <pre><code>var table3 = $('#get-rfp-for-approval-table').DataTable({
     'processing': true,
     'serverSide': true,
      ajax: {
          url: '/requests/request-for-payment/getRFPforApproval',
          dataSrc: ''
      },
      columns: [ 
          { data: '#' },
          { data: 'number' },
          { data: 'vendor' },
          { data: 'document_reference' },
          { data: 'date_needed' },
          { data: 'requesting_department' },
          { data: 'amount' },
          { data: 'status' },
          { data: 'created_by' },
          { data: 'approval_status' },
          { data: 'action' },
          { data: 'checkbox' },
      ],
      columnDefs: [
          {
              targets: 11,
              checkboxes: {
                  selectRow: true
              }
          }
      ],
      select: {
          style: 'multi'
      },
      order: [[1,'desc']]
  });
  </code></pre>
  
  <p>Example I have 15 data, I checked data 5 and data 14. then I submit the form.</p>
  
  <p><strong>My form</strong></p>
  
  <pre><code>if ( $('#approved-selected-form').length &gt; 0 ) {
      $('#approved-selected-form').submit(function(e){
          var form = this;  
  
          var rows_selected = table3.column(0).checkboxes.selected();
          // Iterate over all selected checkboxes
          $.each(rows_selected, function(index, rowId){
             // Create a hidden element 
             $(form).append(
                 $('&lt;input&gt;')
                    .attr('type', 'hidden')
                    .attr('name', 'checkbox[]')
                    .val(rowId)
             );
          });
  
          var formData = $(this).serialize();
          swal({
              title: "Are you sure?",
              text: "Transaction will be approved.",
              icon: "warning",
              buttons: true,
              dangerMode: true,
          })
          .then((willSave) =&gt; {
              if (willSave) {
                  $.ajaxSetup({
                      headers: {
                          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                      }
                  })
                  $.ajax({
                      url: '/requests/request-for-payment/approvedTransaction',
                      type: "POST",
                      data: formData,
                      beforeSend: function() {
                          var span = document.createElement("span");
                          span.innerHTML = '&lt;span class="loading-animation"&gt;LOADING...&lt;/span&gt;';
                          swal({
                              content: span,
                              icon: "warning",
                              buttons: false,
                              closeOnClickOutside: false
                          });
                          $('.request-for-payment-finish').attr('disabled', 'disabled');
                      },
                      success: function(response) {
                          if (response != '') {
                              $('#get-request-for-payment-table').DataTable().destroy();
                              getRequestForPaymentTable();
  
                              $('#add-request-for-payment-form').trigger("reset");
                              swal("Transaction has been saved!", {
                                  icon: "success",
                              });
                              setTimeout(
                                  function() 
                                  {
                                      window.location.href = "/requests/request-for-payment?id="+response+"#view-request-for-payment-modal";
                                  }, 1500);
                          }
                      },
                      complete: function() {
                           $('.request-for-payment-finish').removeAttr('disabled');
                      }
                  });
              } else {
                  swal("Save Aborted");
              }
          });
  
          e.preventDefault();
          return false;
      })
  }
  </code></pre>
  
  <p>NOTE: I tried to dd it in my controller it gives me this</p>
  
  <pre><code>array:1 [
    "get-rfp-for-approval-table_length" =&gt; "10"
  ]
  </code></pre>
  
  <p>I also noticed that in my th, I dont have checkbox(when I clicked this, everything will be checked). Im using this as a guide. <a href="https://jsfiddle.net/snqw56dw/3182/" rel="nofollow noreferrer">https://jsfiddle.net/snqw56dw/3182/</a>.</p>
  
  <p>Question: How can I get those values in my controller? </p>