i'm using laravel 5 , in rutes.php i have this code :
Route::get('about',"homeController@about");
and in App\Http\Controllers\ i have file homeController.php that contains :
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller as BaseController;
class homeController extends BaseController{
public function about(){
    return view::make('about');
}
}
but it throws this error : Class App\Http\Controllers\homeController does not exist . how can i fix it ?
here is structure of the project and controllers :

First, check if you write the name of the controller correctly. If it is, there are 3 methods:
Route::get('/about', 'App\Http\Controllers\homeController@about');
Write all the paths where your controller there is.
Route::get('/about', [HomeController::class, 'about');
//protected $namespace = 'App\\Http\\Controllers';
( You will find it in comment)// of comment and save.
with this method, you will able to use the name of the controller directly without
writing all the paths.change your routing like below:
use App\Http\Controllers\HomeController;
Route::get('/about',  [HomeController::class, 'index'])->name('home');
for more info look at this page: https://laravel.com/docs/8.x/routing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With