title: add auto number in server side data table laravel 5
body: <p>I want to add auto number for my table like 1,2,3 until record end. </p>
  
  <p>I use ($no + 1) which I usually use not work.</p>
  
  <p>for load data work fine, But I dont know how to add auto numer
  please help me,</p>
  
  <p>this for my Controller</p>
  
  <pre><code>public function getUser(Request $request)
  {
  
    $columns = array(
        0 =&gt; 'auto_num',
        1 =&gt; 'add_time',
        2 =&gt; 'id'
      );
  
      $totalData = DataTes::count();
      $limit = $request-&gt;input('length');
      $start = $request-&gt;input('start');
      $order = $columns[$request-&gt;input('order.0.column')];
      $dir = $request-&gt;input('order.0.dir');
  
      if(empty($request-&gt;input('search.value'))){
          $posts = DataTes::offset($start)
                  -&gt;limit($limit)
                  -&gt;orderBy($order,$dir)
                  -&gt;get();
          $totalFiltered = DataTes::count();
      }else{
          $search = $request-&gt;input('search.value');
          $posts = DataTes::where('auto_num', 'like', "%{$search}%")
                          -&gt;orWhere('add_time','like',"%{$search}%")
            -&gt;orWhere('id','like',"%{$search}%")
                          -&gt;offset($start)
                          -&gt;limit($limit)
                          -&gt;orderBy($order, $dir)
                          -&gt;get();
          $totalFiltered = DataTes::where('auto_num', 'like', "%{$search}%")
                          -&gt;orWhere('add_time','like',"%{$search}%")
            -&gt;orWhere('id','like',"%{$search}%")
                          -&gt;count();
      }
  
  
      $data = array();
  
      if($posts){
          $counter = 1;
          foreach($posts as $r){
              $nestedData['auto_num'] = $r-&gt;auto_num;
              $nestedData['add_time'] = $r-&gt;add_time;
              $nestedData['id'] = $r-&gt;id;
              $nestedData['no'] = $counter;
              $data[] = $nestedData;
              $counter++;
          }
      }
  
      $json_data = array(
          "draw"          =&gt; intval($request-&gt;input('draw')),
          "recordsTotal"  =&gt; intval($totalData),
          "recordsFiltered" =&gt; intval($totalFiltered),
          "data"          =&gt; $data
      );
  
      echo json_encode($json_data);
  
  
  }
  </code></pre>
  
  <p>and this for my js</p>
  
  <pre><code>    $('#example1').DataTable( {
      "ordering": true,
      'autoWidth': true,
  
              "processing": true,
              "serverSide": true,
              "ajax": {
                  "url":"&lt;?= route('dataProcessing') ?&gt;",
                  "dataType":"json",
                  "type":"POST",
                  "data":{"_token":"&lt;?= csrf_token() ?&gt;"}
              },
              "columns":[
        {"data": "auto_num"},
        {"data": "add_time"},
        {"data": "id"},
        {"data": "no"}
              ]
          } );
  </code></pre>
  
  <p>I hope you can understand what I mean
  sorry for my bad english, I use laravel v5.6</p>