Merge branch 'develop' of github.com:laravel/laravel into develop

This commit is contained in:
Taylor Otwell 2012-06-03 17:37:05 -05:00
commit d9c0dc0c35
5 changed files with 29 additions and 11 deletions

View File

@ -18,7 +18,7 @@
</header> </header>
<div role="main" class="main"> <div role="main" class="main">
<div class="home"> <div class="home">
<h2>Learn the terrain.</h3> <h2>Learn the terrain.</h2>
<p> <p>
You've landed yourself on our default home page. The route that You've landed yourself on our default home page. The route that
@ -34,7 +34,7 @@
<h2>Grow in knowledge.</h2> <h2>Grow in knowledge.</h2>
<p> <p>
Leaning to use Laravel is amazingly simple thanks to Learning to use Laravel is amazingly simple thanks to
its {{ HTML::link('docs', 'wonderful documentation') }}. its {{ HTML::link('docs', 'wonderful documentation') }}.
</p> </p>

View File

@ -148,15 +148,19 @@
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Next we're ready to determine the application environment. This may be | Next we're ready to determine the application environment. This may be
| set either via the command line options, or, if the request is from | set either via the command line options or via the mapping of URIs to
| the web, via the mapping of URIs to environments that lives in | environments that lives in the "paths.php" file for the application and
| the "paths.php" file for the application and is parsed. | is parsed. When determining the CLI environment, the "--env" CLI option
| overrides the mapping in "paths.php".
| |
*/ */
if (Request::cli()) if (Request::cli())
{ {
$environment = get_cli_option('env'); $environment = get_cli_option('env');
if (! isset($environment)) {
$environment = Request::detect_env($environments, gethostname());
}
} }
else else
{ {

View File

@ -230,11 +230,9 @@ public static function update($id, $attributes)
* @param array $columns * @param array $columns
* @return Model * @return Model
*/ */
public static function find($id, $columns = array('*')) public function _find($id, $columns = array('*'))
{ {
$model = new static; return $this->query()->where(static::$key, '=', $id)->first($columns);
return $model->query()->where(static::$key, '=', $id)->first($columns);
} }
/** /**
@ -746,10 +744,12 @@ public function __call($method, $parameters)
return static::$$method; return static::$$method;
} }
$underscored = array('with', 'find');
// Some methods need to be accessed both staticly and non-staticly so we'll // Some methods need to be accessed both staticly and non-staticly so we'll
// keep underscored methods of those methods and intercept calls to them // keep underscored methods of those methods and intercept calls to them
// here so they can be called either way on the model instance. // here so they can be called either way on the model instance.
if (in_array($method, array('with'))) if (in_array($method, $underscored))
{ {
return call_user_func_array(array($this, '_'.$method), $parameters); return call_user_func_array(array($this, '_'.$method), $parameters);
} }

View File

@ -307,6 +307,10 @@ #### Registering a filtered route that points to a controller action:
Route::get('welcome', array('after' => 'log', 'uses' => 'home@index')); Route::get('welcome', array('after' => 'log', 'uses' => 'home@index'));
#### Registering a named route that points to a controller action:
Route::get('welcome', array('as' => 'home.welcome', 'uses' => 'home@index'));
<a name="cli-route-testing"></a> <a name="cli-route-testing"></a>
## CLI Route Testing ## CLI Route Testing

View File

@ -334,4 +334,14 @@ public function status($status = null)
} }
} }
/**
* Render the response when cast to string
*
* @return string
*/
public function __toString()
{
return $this->render();
}
} }