I want to set the localization using subdomains. I've managed to set up subdomain wildcards and it's working fine. However I'd like to set up filters. For example I was thinking of setting up an array of available countries in the config:
<?php
return array(
'available' => array(
'uk',
'fr',
'de'
)
);
Then in my routes I need a way of filtering a group. For the moment my code is the following without any filters:
<?php
$homeController = 'MembersController@profile';
if ( ! Sentry::check())
{
$homeController = 'HomeController@index';
}
Route::group(['domain' => '{locale}.'.Config::get('app.base_address')], function() use ($homeController)
{
Route::get('/', ['as' => 'home', 'uses' => $homeController]);
Route::post('users/register', ['as' => 'register', 'uses' => 'UsersController@register']);
Route::resource('users', 'UsersController');
});
Does anyone have any ideas for filtering the group?
Also if the subdomain isn't valid how can I redirect to something like uk.domainname.com?
Thank you in advance for any help, it's much appreciated.