with('sidebar', document('contents')); }); /** * Handle the documentation homepage. * * This page contains the "introduction" to Laravel. */ Route::get('(:bundle)', function() { return View::make('docs::page')->with('content', document('home')); }); /** * Handle documentation routes for sections and pages. * * @param string $section * @param string $page * @return mixed */ Route::get('(:bundle)/(:any)/(:any?)', function($section, $page = null) { $file = rtrim(implode('/', func_get_args()), '/'); // If no page was specified, but a "home" page exists for the section, // we'll set the file to the home page so that the proper page is // display back out to the client for the requested doc page. if (is_null($page) and document_exists($file.'/home')) { $file .= '/home'; } if (document_exists($file)) { return View::make('docs::page')->with('content', document($file)); } else { return Response::error('404'); } });