title: Return Date To Client From Within DB::Transaction Closure()
body: <p>I am executing several database saves within my db transaction closure:</p>
  
  <pre><code>DB::transaction(function() {
      ...
  });
  </code></pre>
  
  <p>However what i want to do now is when a transaction fails instead of throwing an exception i want to return a custom JSON object straight t the client, if the transactions succeeds i want to do the same thing.</p>
  
  <p>This is my object:</p>
  
  <pre><code>return [
    'code' =&gt; '',
    'message' =&gt; '',
    'data' =&gt; []
  ];
  </code></pre>
  
  <p>How would i return the above to the client from within the closure?</p>