close

[Solved] Route resource not working in Laravel 8.x

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Route resource not working in Laravel 8.x in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Route resource not working in Laravel 8.x Error Occurs?

Today I get the following error Route resource not working in Laravel 8.x in php.

How To Solve Route resource not working in Laravel 8.x Error ?

  1. How To Solve Route resource not working in Laravel 8.x Error ?

    To Solve Route resource not working in Laravel 8.x Error Run following step for clear route cache
    php artisan route:clear

  2. Route resource not working in Laravel 8.x

    To Solve Route resource not working in Laravel 8.x Error Run following step for clear route cache
    php artisan route:clear

Solution 1

Run following step for clear route cache

php artisan route:clear

Solution 2

So the reason this is an issue is because Laravel 8 removed the default namespace on the RouteServiceProvider.

If you want to use the ProfileController::class functionality you need to reset the protected $namespace to be null in the RouteProvider to match the base code.

Otherwise it will prepend the $namespace to whichever class you pass.

so change

protected $namespace = null

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

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment