samedi 24 octobre 2015

Return Date To Client From Within DB::Transaction Closure()

I am executing several database saves within my db transaction closure:

DB::transaction(function() {
    ...
});

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.

This is my object:

return [
  'code' => '',
  'message' => '',
  'data' => []
];

How would i return the above to the client from within the closure?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1i3SAZp
via IFTTT

Aucun commentaire:

Enregistrer un commentaire