skip to Main Content

**Target class ** does not exist. ?? Why I didn’t understand

Error Is lluminateContractsContainerBindingResolutionException
Target class [appHttpControllersFrontEndIndexController] does not exist.

IlluminateContainerContainer::build
C:xampphtdocscheck-time.comvendorlaravelframeworksrcIlluminateContainerContainer.php:875

I am Using Laravel 8. Environment information
Laravel version
8.47.0
Laravel locale
en
Laravel config cached
true
PHP version
8.0.6

 <?php
     namespace AppHttpControllersFrontEnd;
    use IlluminateHttpRequest;
    use AppHttpControllersController;
     class IndexController extends Controller
    {
        public function UserGuide(){
    
            return view('FrontEnd.FrontWeb.User-Guide');
        }
        public function About(){
    
            return view('FrontEnd.FrontWeb.about');
        }
        public function Download(){
    
            return view('FrontEnd.FrontWeb.download');
        }
        public function ContectUs(){
    
            return view('FrontEnd.FrontWeb.contact-us');
        }
       }

Here is My Web.php Route

<?php

use IlluminateSupportFacadesRoute;
use appHttpControllersController;
use IlluminateSupportFacadesAuth;
use AppHttpControllersBackendAdminDashboardController;
use AppHttpControllersBackendCategoryController;
use AppHttpControllersUserGuideUserGuideController;
use AppHttpControllersBackendAdminController;
use AppHttpControllersFrontEndIndexController;


// front end Route All GO Here


Route::get('/', function () {
    return view('FrontEnd.FrontWeb.index');
});


Route::get('/User-Guide',[IndexController::class,'UserGuide'])->name('User.Guide');
Route::get('/about',[IndexController::class,'About'])->name('About.Page');
Route::get('/check-time-Software-download',[IndexController::class,'Download'])->name('Download.Page');
Route::get('/contact-us',[IndexController::class,'ContectUs'])->name('Contact.Us');


// Admin Route All Here

Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {

    return view('dashboard');

})->name('dashboard');


Route::get('logout/',[AdminController::class,'logout'])->name('user.logout');

2

Answers


  1. Namespaces are case-sensitive. In Laravel, the app namespace is with a lowercase a.

    Login or Signup to reply.
  2. Method 1 :
    Just import your controller in the routes file, like the following example, or use full path with controller file.

    use AppHttpControllersIndexController;
    Route::post(‘/about’ , ‘IndexController@About’);

    //OR

    Route::get(‘/about’, ‘AppHttpControllersIndexController@About’);

    Method 2 :
    Go to app/Providers/RouteServiceProvider.php and find and enable this line, as it should be commented.

    protected $namespace = 'App\Http\Controllers';
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search