質問

I have a page in the database. I want to have a URL like mysite.com/page_alias for the page.
How do I properly write route in laravel 4.
In kohana i did this:

Route::set('static', '<page>', array('page' => "page|page2|page3|etc"))
        ->defaults(array(
            'action' => 'index',
            'controller' => 'Static',
            'directory' => 'Index',
        ));

Thanks.
Sorry for my english.

役に立ちましたか?

解決

I never use Kohana but looking at its doc, if I'm right, this is the closest way to do what you used to do with Kohana.

Route::get('{page}', 'StaticController@index')->where('page', 'page|page2|page3|etc');

PS: take a look at this http://laravel.com/docs/4.2/routing (you probably have already checked the doc but in case..)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top