I have the following code in my routes file:
$domain1 = 'www.domain1.co.uk';
Route::group(array('domain' => $domain1), function() use ($domain1)
{
Route::get('/', 'PrimaryController@index');
});
How can I pass the variable $domain1
to the controller method?
To expand to a more general question, how can I simply declare some variable in my routes file and then pass it to a controller? I know I can do this:
Route::get('tours/{id}/{title}', 'PrimaryController@tourHandler');
...and have access to the $id and $title variables in the controller- Which is great if those variables are present in the URL. But what if, for whatever reason, I want access to some specific variables which I want to set myself in the routes file?
Laravel seems too clever sometimes.