Skip to content

Commit

Permalink
Updating documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 28, 2013
1 parent eff2f84 commit 47d6be8
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 7 deletions.
4 changes: 4 additions & 0 deletions controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ You may also specify names on controller routes:
Route::get('foo', array('uses' => 'FooController@method',
'as' => 'name'));

You may access the name of the controller action being run using the `currentRouteAction` method:

$action = Route::currentRouteAction();

> **Note:** After creating a new class, make sure to run `composer dump-autoload` from the command line. This will allow the framework to automatically load your class.
<a name="controller-filters"></a>
Expand Down
8 changes: 8 additions & 0 deletions database.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ The `select` method will always return an `array` of results.

DB::statement('drop table users');

You may listen for query events using the `DB::listen` method:

**Listening For Query Events**

DB::listen(function($sql, $bindings, $time)
{
//
});

<a name="accessing-connections"></a>
## Accessing Connections
Expand Down
15 changes: 15 additions & 0 deletions eloquent.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ Once a model is defined, you are ready to start retrieving and creating records

> **Note:** All methods available on the [query builder](/docs/queries) are also available when querying Eloquent models.
**Retrieving A Model By Primary Key Or Throw An Exception**

Sometimes you may wish to throw an exception if a model is not found, allowing you to catch the exceptions using an `App::error` handler and display a 404 page.

$model = User::findOrFail(1);

To register the error handler, listen for the `ModelNotFoundException`

use Illuminate\Database\Eloquent\ModelNotFoundException;

App::error(function(ModelNotFoundException $e)
{
return Response::make('Not Found', 404);
});

**Querying Using Eloquent Models**

$users = User::where('votes', '>', 100)->take(10)->get();
Expand Down
2 changes: 1 addition & 1 deletion mail.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<a name="configuration"></a>
## Configuration

Laravel provides a clean, simple API over the popular [SwiftMailer](http:https://swiftmailer.org) library. The mail configuration file is `app/config/mail.php`, and contains options allowing you to change your SMTP host, port, and credentials, as well as set a global `from` address for all messages delivered by the library. You may use any SMTP server you wish.
Laravel provides a clean, simple API over the popular [SwiftMailer](http:https://swiftmailer.org) library. The mail configuration file is `app/config/mail.php`, and contains options allowing you to change your SMTP host, port, and credentials, as well as set a global `from` address for all messages delivered by the library. You may use any SMTP server you wish. If you wish to use the PHP `mail` function to send mail, you may change the `driver` to `mail` in the configuration file.

<a name="basic-usage"></a>
## Basic Usage
Expand Down
2 changes: 2 additions & 0 deletions migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ Laravel also includes a simple way to seed your database with test data using se
public function run()
{
$this->call('UserTableSeeder');

$this->command->info('User table seeded!');
}

}
Expand Down
6 changes: 6 additions & 0 deletions queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ The database query builder provides a convenient, fluent interface to creating a

$users = DB::table('users')->select('name as user_name')->get();

**Adding A Select Clause To An Existing Query**

$query = DB::table('users')->select('name');

$users = $query->addSelect('age')->get();

**Using Where Operators**

$users = DB::table('users')->where('votes', '>', 100)->get();
Expand Down
6 changes: 1 addition & 5 deletions requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ You may access all user input with a few simple methods. You do not need to worr

$input = Input::except('credit_card');

Some JavaScript libraries such as Backbone may send input to the application as JSON.

**Retrieving JSON Input**

$input = Input::json();
Some JavaScript libraries such as Backbone may send input to the application as JSON. You may access this data via `Input::get` like normal.

<a name="cookies"></a>
## Cookies
Expand Down
6 changes: 5 additions & 1 deletion routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Route filters provide a convenient way of limiting access to a given route, whic
}
});

If a response is returned from a filter, that response will be considered the response to the request and the route will not be executed.
If a response is returned from a filter, that response will be considered the response to the request and the route will not be executed, and any `after` filters on the route will also be cancelled.

**Attaching A Filter To A Route**

Expand Down Expand Up @@ -171,6 +171,10 @@ Now, you may use the route's name when generating URLs or redirects:

$redirect = Redirect::route('profile');

You may access the name of a route that is running via the `currentRouteName` method:

$name = Route::currentRouteName();

<a name="route-groups"></a>
## Route Groups

Expand Down
6 changes: 6 additions & 0 deletions templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ To escape the output, you may use the triple curly brace syntax:

@include('view.name')

**Displaying Language Lines**

@lang('language.line')

@choice('language.line', 1);

**Comments**

{{-- This comment will not be in the rendered HTML --}}
4 changes: 4 additions & 0 deletions testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ The `getContent` method will return the evaluated string contents of the respons

$this->assertEquals('John', $view['name']);

To call a HTTPS route, you may use the `callSecure` method:

$response = $this->callSecure('GET', 'foo/bar');

### DOM Crawler

You may also call a route and receive a DOM Crawler instance that you may use to inspect the content:
Expand Down

0 comments on commit 47d6be8

Please sign in to comment.