Skip to content
Home » Route resource not working in Laravel 8.x

Route resource not working in Laravel 8.x

To solve Route resource not working in Laravel 8.x error follow below methods.

ERROR LOG

Route resource not working in Laravel 8.x

How to solve Route resource not working in Laravel 8.x ?

Refer the given methods to solve the issue.

Method 1:

The reason for this is that Laravel 8 removed the default namespace from the RouteServiceProvider.

To match the base code, you must reset the protected $namespace to null in the RouteProvider if you want to use the ProfileController::class feature.

Otherwise, it will append the $namespace to the class you specify.

so alter

protected $namespace = null

Then remove the ->namespace('Admin') from your routes.php file

Method 2 :

Route::prefix('admin')->namespace('Admin')->group(static function() {

    Route::middleware('auth')->group(static function () {
        //...
        Route::resource('profile', '\App\Http\Controllers\Admin\ProfileController');
    });
});

Hope the above solution works.

Also read :

Xdebug Could not connect to debugging client. Tried: localhost:9000
Replicating claims as headers is deprecated and will removed from v4.0 – Laravel