Skip to content

Commit

Permalink
Merge branch 'master' of github.com:laravel/docs
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 12, 2013
2 parents c3e1082 + 5982804 commit 793ff27
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The `VALUE_NONE` option indicates that the option is simply used as a "switch":

### Retrieving Input

While you command is executing, you will obviously need to access the values for the arguments and options accepted by your application. To do so, you may use the `argument` and `option` methods:
While your command is executing, you will obviously need to access the values for the arguments and options accepted by your application. To do so, you may use the `argument` and `option` methods:

**Retrieving The Value Of A Command Argument**

Expand Down
2 changes: 1 addition & 1 deletion controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ This single route declaration creates multiple routes to handle a variety of RES
Verb | Path | Action
----------|-----------------------|--------------
GET | /resource | index
GET | /resource/new | create
GET | /resource/create | create
POST | /resource | store
GET | /resource/{id} | show
GET | /resource/{id}/edit | edit
Expand Down
11 changes: 9 additions & 2 deletions eloquent.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ The SQL performed by this statement will be as follows:

select * from phones where user_id = 1

Take note that Eloquent assumes the foreign key of the relationship based on the model name. In this case, `User` model is assumed to use a `user_id` foreign key. If you wish to override this convention, you may pass a second argument to the `hasOne` method:
Take note that Eloquent assumes the foreign key of the relationship based on the model name. In this case, `Phone` model is assumed to use a `user_id` foreign key. If you wish to override this convention, you may pass a second argument to the `hasOne` method:

return $this->hasOne('Phone', 'custom_key');

Expand Down Expand Up @@ -383,11 +383,18 @@ Sometimes you may wish to eager load a relationship, but also specify a conditio
$users = User::with(array('posts' => function($query)
{
$query->where('title', 'like', '%first%');

}))->get();

In this example, we're eager loading the user's posts, but only if the post's title column contains the word "first".

### Lazy Eager Loading

It is also possible to eagerly load related models directly from an already existing model collection. This may be useful when dynamically deciding whether to load related models or not, or in combination with caching.

$books = Book::all();

$books->load('author', 'publisher');

<a name="inserting-related-models"></a>
## Inserting Related Models

Expand Down
2 changes: 1 addition & 1 deletion packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This command will prompt you for several pieces of information, such as the vend

The vendor name is a way to distinguish your package from other packages of the same name from different authors. For example, if I (Taylor Otwell) were to create a new package named "Zapper", the vendor name could be `Taylor` while the package name would be `Zapper`.

Once the `workbench` command has been executed, your package will be available within the `workbench` directory of your Laravel installation. First, you should run a `composer install` command from the root directory of your workbench package, which will install any dependencies and generate the Composer autoload files for your package. You may instruct the `workbench` command to do this automatically when creating a package using the `--composer` directive:
Once the `workbench` command has been executed, your package will be available within the `workbench` directory of your Laravel installation. First, you should run a `composer install` command **from the root directory of your workbench package**, which will install any dependencies and generate the Composer autoload files for your package. You may instruct the `workbench` command to do this automatically when creating a package using the `--composer` directive:

**Creating A Workbench Package And Running Composer**

Expand Down
8 changes: 4 additions & 4 deletions queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ The query builder also provides a variety of aggregate methods, such as `count`,

$price = DB::table('orders')->max('price');

$price = DB::table('users')->min('price');
$price = DB::table('orders')->min('price');

$price = DB::table('users')->avg('price');
$price = DB::table('orders')->avg('price');

$total = DB::table('users')->sum('votes');

Expand Down Expand Up @@ -187,14 +187,14 @@ Sometimes you may need to use a raw expression in a query. These expressions wil

DB::table('users')
->where('id', 1)
->update(['votes' => 1]);
->update(array(votes' => 1));

<a name="deletes"></a>
## Deletes

**Deleting Records In A Table**

DB::table('users')->where('votes', < 100)->delete();
DB::table('users')->where('votes', '<', 100)->delete();

**Deleting All Records From A Table**

Expand Down
4 changes: 4 additions & 0 deletions responses.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ Note that there is no convention on where composer classes may be stored. You ar

return Response::json(array('name' => 'Steve', 'state' => 'CA'));

**Creating A JSONP Response**

return Response::json(array('name' => 'Steve', 'state' => 'CA'))->setCallback(Input::get('callback'));

**Creating a File Download Response**

return Response::download($pathToFile);
Expand Down
5 changes: 2 additions & 3 deletions routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ Route filters provide a convenient way of limiting access to a given route, whic
{
return Redirect::to('home');
}
}
});

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.
Expand Down Expand Up @@ -188,15 +187,15 @@ Laravel routes are also able to handle wildcard sub-domains, and pass you wildca

**Registering Sub-Domain Routes**

Route::group(array('domain' => '{account}.myapp.com', function()
Route::group(array('domain' => '{account}.myapp.com'), function()
{

Route::get('user/{id}', function($account, $id)
{
//
});

}));
});

<a name="throwing-404-errors"></a>
## Throwing 404 Errors
Expand Down
2 changes: 1 addition & 1 deletion validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ Laravel provides a variety of helpful validation rules; however, you may wish to

Validator::extend('foo', function($attribute, $value, $parameters)
{
return $value == 'foo'
return $value == 'foo';
});

The custom validator Closure receives three arguments: the name of the `$attribute` being validated, the `$value` of the attribute, and an array of `$parameters` passed to the rule.
Expand Down

0 comments on commit 793ff27

Please sign in to comment.