Created
June 3, 2014 09:23
-
-
Save syossan27/f217fd8e7c1c17ebced3 to your computer and use it in GitHub Desktop.
LaravelでDB処理を書くときに気を付けたいこと ref: http://qiita.com/syo/items/e269b4784c75cff821c4
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
try | |
{ | |
// InsertとかupdateとかのDB処理 | |
} catch(exception e) | |
{ | |
// エラー内容の表示 | |
} |
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
$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