title: DB::transaction throw Undefined variable Error Exception
body: <p>Working on Laravel 5 DB::transaction but throwing following error:</p>
  
  <blockquote>
    <p>exception 'ErrorException' with message 'Undefined variable: tasks'</p>
  </blockquote>
  
  <p><strong>Here is my code:</strong></p>
  
  <pre><code>private function addTasks($tasks, $id) {
    DB::transaction(function() {
      DB::table('task')-&gt;whereIn('id', $tasks)-&gt;update(array('task_parent_id' =&gt; $id));
    });
  }
  </code></pre>
  
  <p><strong>Note: Its working fine without <code>DB::transaction</code> function.</strong></p>
  
  <p>I've checked every line of code but found nothing wrong, please let me know where did wrong?</p>