- Learn the terrain.
+
Learn the terrain.
+ Learn the terrain.
You've landed yourself on our default home page. The route that @@ -34,7 +34,7 @@
Grow in knowledge.
- Leaning to use Laravel is amazingly simple thanks to + Learning to use Laravel is amazingly simple thanks to its {{ HTML::link('docs', 'wonderful documentation') }}.
diff --git a/laravel/core.php b/laravel/core.php index 0dcaaca5..eb24b950 100644 --- a/laravel/core.php +++ b/laravel/core.php @@ -148,15 +148,19 @@ Request::$foundation = RequestFoundation::createFromGlobals(); |-------------------------------------------------------------------------- | | 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 -| the web, via the mapping of URIs to environments that lives in -| the "paths.php" file for the application and is parsed. +| set either via the command line options or via the mapping of URIs to +| environments that lives in the "paths.php" file for the application and +| is parsed. When determining the CLI environment, the "--env" CLI option +| overrides the mapping in "paths.php". | */ - if (Request::cli()) { $environment = get_cli_option('env'); + + if (! isset($environment)) { + $environment = Request::detect_env($environments, gethostname()); + } } else { diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 91aedd6e..2c28b8f9 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -230,11 +230,9 @@ abstract class Model { * @param array $columns * @return Model */ - public static function find($id, $columns = array('*')) + public function _find($id, $columns = array('*')) { - $model = new static; - - return $model->query()->where(static::$key, '=', $id)->first($columns); + return $this->query()->where(static::$key, '=', $id)->first($columns); } /** @@ -746,10 +744,12 @@ abstract class Model { return static::$$method; } + $underscored = array('with', 'find'); + // 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 // 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); } diff --git a/laravel/documentation/routing.md b/laravel/documentation/routing.md index fc607cb9..18c90671 100644 --- a/laravel/documentation/routing.md +++ b/laravel/documentation/routing.md @@ -307,6 +307,10 @@ This routing convention may not be desirable for every situation, so you may als 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')); + ## CLI Route Testing diff --git a/laravel/response.php b/laravel/response.php index e5472430..b6fa4d84 100644 --- a/laravel/response.php +++ b/laravel/response.php @@ -334,4 +334,14 @@ class Response { } } + /** + * Render the response when cast to string + * + * @return string + */ + public function __toString() + { + return $this->render(); + } + } \ No newline at end of file