Skip to content

Commit

Permalink
Document database transactions. Closes laravel#194.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed May 3, 2013
1 parent 9e40178 commit 3f2308c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions database.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- [Configuration](#configuration)
- [Running Queries](#running-queries)
- [Database Transactions](#database-transactions)
- [Accessing Connections](#accessing-connections)

<a name="configuration"></a>
Expand Down Expand Up @@ -49,6 +50,18 @@ You may listen for query events using the `DB::listen` method:
//
});

<a name="database-transactions"></a>
## Database Transactions

To run a set of operations within a database transaction, you may use the `transaction` method:

DB::transaction(function()
{
DB::table('users')->update(array('votes' => 1));

DB::table('posts')->delete();
});

<a name="accessing-connections"></a>
## Accessing Connections

Expand Down

0 comments on commit 3f2308c

Please sign in to comment.