Home > Software design >  Controller doesnt exists in laravel. how can i solve this?
Controller doesnt exists in laravel. how can i solve this?

Time:04-18

[Target class [app\Http\Controllers\ProductController] does not exist.

use app\Http\Controllers\ProductController; 

Route::post('/addprodut',[ProductController::class,'addProduct'])->name('addproduct');

controller name is correct but still i am getting problem]1

CodePudding user response:

Clean and cache your Routes with:

php artisan cache:clear

php artisan route:cache

(if all was ok, should work. If not check names and namespaces)

CodePudding user response:

You created controller using command or just created a php file? If you created it manually then check the class name first, else

just renamed(or created any other name controller) the controller and it'll fixed.

  • Related