Skip to content

Instantly share code, notes, and snippets.

Created Mar 21, 2014
What would you like to do?
Laravel routes and locales made simple (@barryvdh solution)
$languages = array('nl','fr');
$locale = Request::segment(1);
if(in_array($locale, $languages))
$locale = null;
Route::group(array('prefix' => $locale), function()
Route::get('/', array('as' => 'home', function(){ //Do something }));
Route::get('news', array('as' => 'news', 'uses' => 'NewsController@showIndex'));
Route::get('{slug}', 'PageController@showPage');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment