From 72aaf60241be68840ab94a6e5e20e9672bb4efcc Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 22 Sep 2011 00:09:53 -0500 Subject: [PATCH] add better comments in laravel file. --- laravel/laravel.php | 60 +++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/laravel/laravel.php b/laravel/laravel.php index d8d0732b..eefb0173 100644 --- a/laravel/laravel.php +++ b/laravel/laravel.php @@ -1,23 +1,28 @@ resolve('laravel.session.manager'); @@ -25,9 +30,12 @@ $container->instance('laravel.session', $session->payload(Config::get('session'))); } -// -------------------------------------------------------------- -// Route the request and get the response from the route. -// -------------------------------------------------------------- +/** + * Resolve the incoming request instance from the IoC container and route the + * request to the proper route in the application. If a route is found, the route + * will be called with the current requst instance. If no route is found, the 404 + * response will be returned to the browser. + */ $request = $container->resolve('laravel.request'); list($method, $uri) = array($request->method(), $request->uri()); @@ -43,14 +51,18 @@ $response = Response::error('404'); } -// -------------------------------------------------------------- -// Stringify the response. -// -------------------------------------------------------------- +/** + * Stringify the response. We need to force the response to be stringed before + * closing the session, since the developer may be using the session within their + * views, so we cannot age the session data until the view is rendered. + */ $response->content = $response->render(); -// -------------------------------------------------------------- -// Close the session and write the session cookie. -// -------------------------------------------------------------- +/** + * Close the session and write the active payload to persistent storage. The input + * for the current request is also flashed to the session so it will be available + * for the next request via the Input::old method. + */ if (isset($session)) { $flash = array(Input::old_input => $container->resolve('laravel.input')->get()); @@ -58,7 +70,7 @@ $session->close($container->resolve('laravel.session'), Config::get('session'), $flash); } -// -------------------------------------------------------------- -// Send the response to the browser. -// -------------------------------------------------------------- +/** + * Finally, we can send the response to the browser. + */ $response->send(); \ No newline at end of file