Last active
December 27, 2021 14:30
-
-
Save deyvicode/3975f7f5e1c727f130d6e836613078ab to your computer and use it in GitHub Desktop.
Una transacción es para asegurar que todo el proceso sea completado con exito, de no ser asi se revierten los cambios al estado inicial de la transacción.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use DB; | |
// use Log; | |
try { | |
DB::beginTransaction(); | |
// code | |
DB::commit(); | |
} catch (\PDOException $e) { | |
DB::rollBack(); | |
Log::debug($e); | |
throw new \Exception('Exception message'); | |
// abort(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment