title: Laravel wait till Transaction is finished?
body: <p>How can i run something after a transaction is completed?</p>
  
  <p>for example:</p>
  
  <pre><code>$message = array();
  
  DB::transaction(function() use (...) {
       $message = array('12345');  
  }
  
  return response()-&gt;json($message, 200); // == []
  </code></pre>
  
  <p>How can i wait till the closure is finished? when ill try with:</p>
  
  <pre><code>DB::transaction(function() use (...)
  {
       return response()-&gt;json($message, 200); // no response
  }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Ill already found a solution by myself now, when ill use:</p>
  
  <pre><code>$message = DB::transaction(function() use (...) {
       return array('12345');  
  }
  
  // then $message is correct
  </code></pre>