'Laravel 8 Attribute [controller] does not exist
In my route I want to create a group.
Route::controller(ProductController::class)->group(function () {
dd('Hello World');
});
And get the following error message: Attribute [controller] does not exist..
Although it is in the Laravel 8 documentation https://laravel.com/docs/8.x/routing#route-group-controllers I assume that the function does not exist in Laravel 8. Probably an mistake in the documentation!?!?
Note: In Laravel 9 it would work.
Solution 1:[1]
In the early versions of Laravel 8, there is no Route Group Controller they introduce it in laravel version 8.80 please check your laravel version to see if it's the 8.80 version or higher and if it's higher
As of Documentation
Route::controller(OrderController::class)->group(function () {
Route::get('/orders/{id}', 'show');
Route::post('/orders', 'store');
});
you didn't mention any routes inside your group like
Route::controller(OrderController::class)->group(function () {
Route::get('/orders', function(){
dd("hello world!")
});
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
