我的网站在域名exa.com上运行多个子域名,例如,现在我需要设置另一个域名是exa1.com。那么如何更新我的路由文件来实现呢?
Route::group(
array(
'domain' => '{business_slug}.exa.com',
'middleware' => 'verify_domain'
), function() {
Route::get('', [
'as' => 'index',
'uses' => 'HomeController@index'
]);
Route::get('user', [
'as' => 'user.index',
'middleware' => 'auth',
'uses' => 'UserController@index'
]);
...
});
答案 0 :(得分:0)
试试这个:
<?php
$applicationRoutes = function() {
Route::get('/', [
'as' => 'index',
'uses' => 'HomeController@index'
]);
Route::get('user', [
'as' => 'user.index',
'middleware' => 'auth',
'uses' => 'UserController@index'
]);
};
Route::group(['middleware' => 'verify_domain'], function() {
Route::group(
[
'domain' => '{business_slug}.exa.com',
], $applicationRoutes);
Route::group(
[
'domain' => '{business_slug}.exa1.com',
], $applicationRoutes);
});