Skip to content

Instantly share code, notes, and snippets.

@localdisk
Last active January 1, 2016 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save localdisk/8168984 to your computer and use it in GitHub Desktop.
Save localdisk/8168984 to your computer and use it in GitHub Desktop.
Laravel Transaction Example
<?php
Route::post('save', function() {
$user = new User;
$user->username = 'foo';
$user->password = Hash::make('password');
$user->email = 'foo@bar.com';
DB::transaction(function() use ($user) {
$user->save();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment