Skip to content

Instantly share code, notes, and snippets.

@localdisk
Last active January 1, 2016 16:09
Show Gist options
  • 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 = '[email protected]';
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