0

In Latest laravel version

route::post('/Route','classname@method name') 

route not working and getting this Exception.

Target class [PagesController] does not exist. 

Ex:Route::post('/saveTask', 'TaskController@store');

but This way it worked for get method but not for post

Route::get('/about',[FrontendController::class, 'METHODNAME']);
  • 2
    Default namespace as been removed in Laravel 8: https://laravel.com/docs/8.x/upgrade#automatic-controller-namespace-prefixing – Clément Baconnier May 04 '22 at 18:42
  • Why would it work for `post` when you have specified `get`? If you want to use both HTTP methods then use `Route::any()` – Jaquarh May 04 '22 at 18:48
  • Please edit the question to specify what framework you're using. We can guess that it's Laravel by looking at the syntax, but we can't be sure. You should also include what version you've swapped between. – M. Eriksson May 04 '22 at 18:54
  • Yes im using Laravel version 9. Using Route::any() could work for that but i want to know why it did work for get and not for post – manul wickramanayaka May 04 '22 at 19:12
  • Because your post route is defined with old syntax. Follow update steps given in the duplicate answer and the upgrade guide, and don't forget to clear route caches. – miken32 May 04 '22 at 19:48

0 Answers0