I want to setup up a separate routing based on the environment setup on my Laravel 4 application. Would I be able to detect the current executing environment on my routes.php and set the routing of my application?
I want to be able to point multiple domains to a single Laravel application, but load different views based on the domain that is being visited. The following is a sample routing that I am looking at.
/app/routes.php
//All Domains
Route::get('/admin',array('as' => 'loadDashboard', 'uses'=>'AdminController@loadDashboard'));
//If Domain 1
Route::get('/user',array('as' => 'checkLogin', 'uses'=>'Site1Controller@loadDashboard'));
//If Domain 2
Route::get('/user',array('as' => 'checkLogin', 'uses'=>'Site2Controller@loadDashboard'));
//If Domain 3
Route::get('/user',array('as' => 'checkLogin', 'uses'=>'Site3Controller@loadDashboard'));
You could do this using domain routing.
Straight from the docs:
Route::group(array('domain' => 'firstdomain.com'), function()
{
Route::get('/user',array('as' => 'checkLogin', 'uses'=>'Site1Controller@loadDashboard'));
});
Route::group(array('domain' => 'seconddomain.com'), function()
{
Route::get('/user',array('as' => 'checkLogin', 'uses'=>'Site2Controller@loadDashboard'));
});