Skip to content

Instantly share code, notes, and snippets.

@psdtohtml5
Created August 17, 2013 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save psdtohtml5/6256974 to your computer and use it in GitHub Desktop.
Save psdtohtml5/6256974 to your computer and use it in GitHub Desktop.
PHP : Laravel 4 Database transactions
try {
DB::connection()->getPdo()->beginTransaction();
// database queries here
DB::connection()->getPdo()->commit();
} catch (\PDOException $e) {
// Woopsy
DB::connection()->getPdo()->rollBack();
}
@hootlex
Copy link

hootlex commented Sep 23, 2016

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment