Skip to content

Instantly share code, notes, and snippets.

@syossan27
Created June 3, 2014 09:23
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 syossan27/f217fd8e7c1c17ebced3 to your computer and use it in GitHub Desktop.
Save syossan27/f217fd8e7c1c17ebced3 to your computer and use it in GitHub Desktop.
LaravelでDB処理を書くときに気を付けたいこと ref: http://qiita.com/syo/items/e269b4784c75cff821c4
try
{
// InsertとかupdateとかのDB処理
} catch(exception e)
{
// エラー内容の表示
}
$table = Table::find(1);
DB::transaction(function() use($table) {
// InsertとかupdateとかのDB処理
$table->save();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment