title: Passing parameter to each column of datatable
body: <p>In my Laravel 5.6 application, I try to pass a <code>$id</code> variable from my route to each single column of my datatable.</p>
  
  <p>My code:</p>
  
  <pre class="lang-php prettyprint-override"><code> public function getVendorslistChange($id){
      try {
          return Datatables::of($this-&gt;purchaseRepository-&gt;getVendorListData(),$id)
              -&gt;addColumn('action', function ($vendor,$id) {
                  return \Form::open(['method' =&gt; 'POST', 'action' =&gt; ['PurchaseController@postChangeVendor',$id], 'class' =&gt; 'form']) . '
                  &lt;input type="hidden" name="id" value="' . $vendor-&gt;id . '" /&gt;
                  &lt;input type="submit" name="submit" value="Choose" class="btn center-block" /&gt;
                  ' . \Form::close();
              })
              -&gt;make(true);
      } catch (\Exception $e) {
          return $this-&gt;redirectWithErrors($e);
      }
  }
  </code></pre>
  
  <p>this part <code>$this-&gt;purchaseRepository-&gt;getVendorListData()</code> will return the following:</p>
  
  <pre class="lang-php prettyprint-override"><code>public function getVendorListData(){
      $this-&gt;vendors = Vendor::Select(
          array(
              'vendors.id',
              'vendors.company_name'
          ))
          -&gt;where('vendors.company_id',return_company_id())
          -&gt;where('status','Active')-&gt;get()
      ;
      return $this-&gt;vendors;
  }
  </code></pre>
  
  <p>But there is error said, the <code>$id</code> cannot be passed to the <code>addColumn</code>.</p>
  
  <blockquote>
    <p>Too few arguments to function App\Http\Controllers\PurchaseController::App\Http\Controllers{closure}(), 1 passed in /Applications/XAMPP/xamppfiles/htdocs/laravel-project/american_dunnage/vendor/yajra/laravel-datatables-oracle/src/Utilities/Helper.php on line 64 and exactly 2 expected</p>
  </blockquote>
  
  <p>What is the proper way to pass parameter like this to each column of the datatable?</p>