You need to use the optional parameters routing within Laravel, as described in Laravel documentation.
Add the following to your routes.php
. This will handle any other URL except the index page. If you need any other static URLs, add them before this line.
Route::get('/{alias}', array('uses' => 'CmsController@showByAlias'));
Now you need to define the controller that will handle the route. It could be something like this:
class CmsController extends BaseController {
public function showByAlias($alias)
{
$content = Cms::findByAlias($alias);
return View::make('cms.show')->with('content', $content)->with('title',$title);
}
You still need to write a function such as Cms::findByAlias
in your model to retrieve and process the proper content from database. Of course you can do this within the controller itself.
Also note that you need to add error handling in case an invalid alias is passed within the URL. E.g. show a 404 error page in that case.
Just a hint: I am doing a very similar thing within my Laravel application. I am storing all CMS content in markdown format, and converting that to HTML within Laravel using Parsedown, before passing it to the view. Suits my needs perfectly.