title: Laravel 4: DB::transaction offer a callback to see result
body: <p>i am using the DB::transaction within a project all works fine, but what i am doing first is creating a folder:</p>
  
  <pre><code>  $folder = \File:: makeDirectory($path, perm, recur);
  </code></pre>
  
  <p>then on passing this i then init my DB::transaction:</p>
  
  <pre><code>  if($folder){
      \DB::transaction(function() use($folderName){
          /////--- do the db stuff in here.
  
     })
    } else {
      ///-- folder creation failed return message
    }
  </code></pre>
  
  <p>This is all good but if my folder is created then the DB::transaction fails, there is no way for me to know this so i can then remove the folder created and then inform the user that the current process failed.</p>
  
  <p>Any ideas how i can get a callback type so that if it fails then remove folder, i have tried a try catch but with laravels own errors take over, and it does not get that far?</p>
  
  <p>SO how could i achieve this?</p>