在我的路线上,我想创建一个小组。
Route::controller(ProductController::class)->group(function () {
dd('Hello World');
});
并获得以下错误消息:Attribute [controller] does not exist.
。
虽然它在Laravel 8文档https://laravel.com/docs/8.x/routing#route-group-controllers中,但我假设该函数在Laravel 8中不存在。可能是文档中的一个错误!??
注:在Laravel 9,它会工作。
发布于 2022-02-12 10:40:35
在Laravel 8的早期版本中,没有路由组控制器--他们在laravel版本8.80中引入了它--请检查您的laravel版本,看看它是8.80版本还是更高版本,是否更高
截至文件
Route::controller(OrderController::class)->group(function () {
Route::get('/orders/{id}', 'show');
Route::post('/orders', 'store');
});
你没有提到你团队里的任何路线
Route::controller(OrderController::class)->group(function () {
Route::get('/orders', function(){
dd("hello world!")
});
});
https://stackoverflow.com/questions/71090952
复制相似问题