【发布时间】:2021-05-23 14:34:04
【问题描述】:
我是 Laravel 8 的新手。在之前的 Laravel 版本 7 中,我们可以通过这种方式传递 子域 名称
Route::group( [ 'domain' => '{admin}.example.com' ], function () {
Route::get('/index', 'HomeController@index($account)' );
}
但是,在 Laravel 8 中调用 Controller 的结构代码是这样改变的。
Route::domain('{admin}.example.com')->group(function () {
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
});
我一直在寻找文档,但没有找到。你能给我看文档或帮我发送/传递 subdomain 从 web.php 到 Controller
【问题讨论】:
-
您的错误或问题是什么?
-
@matiaslauriti 我不知道使用 laravel 8 将我的子域名传递给我的控制器。在以前的版本中,我们可以使用 @index($admin)
-
我不确定在以前的版本中
index($account)是否有必要将参数传递给控制器。使用HomeController@index并在控制器方法中使用参数一直有效