Skip to content

DataOps Blog

Just another DataOps site

  • Home
  • certification
  • consultant
  • consulting
  • Contact Us!
  • courses
  • Intro to Laravel
  • tools
  • trainer
  • training

How to fix ‘Target class does not exist’ in Laravel 8

September 8, 2021
By Rajesh Kumar In Laravel

How to fix ‘Target class does not exist’ in Laravel 8

In this tutorial im going to fix target class does not exist. Why its comes Target class does not exists — Its means in Route/web.php file you are not imported your controller name. first you have to import your controller name in web.php file. As define below.

1 step go to your controller file and check your controller name

<?php

namespace App\Http\Controllers;
use App\Http\Controllers\Controller;

use Illuminate\Http\Request;

class ContactController extends Controller
{
public function index(){
return view('contact');
}
}

2nd Step go to Route/web.php file and import your controller file name.

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\ContactController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
return view('welcome');
});

Route::get('/about',function(){
return view('about');
});


Route::get('contact', [ContactController::class, 'index']);

Now run this command in your terminal

php artisan serve

Now project run successfully.

Laravel laravel-error localhost target-class
Written by:

Rajesh Kumar

View All Posts

Recent Posts

  • The Online Dating Association (ODA) Maintains the Gold Standard for online dating sites in britain
  • Tips Balance On The Internet And Typical Dating
  • meet black gay men Gay Hookups
  • (no title)
  • (no title)
  • Online Casinos Offer No Deposit Casino Bonus Codes
  • A Board Website Review
  • How you can Remove Disease From ipad device
  • Dating – When You Should Discuss Dirty Little Methods?
  • How to Find the Top Canadian Online Casino
  • Research Papers For Sale
  • Free Slot Machine Games – Tips to Play Slots Free
  • (no title)
  • Why Use a VPN Online?
  • The very best GTA Games
  • DesignLab Xbox 360 – Create Your Very Own Controllers
  • Tips on how to Conduct Individual Businesses
  • Tips on how to Download the Best Android Programs
  • Finest Antivirus Totally free
  • VPN USA — Protect Your web Privacy and Unblock Geo-Restricted Content

Archives

Categories

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
  • Free Video Tutorials
  • DevOps School
  • Best DevOps
  • scmGalaxy
  • Artificial Intelligence
  • DataOps
  • AIOps
  • GuruKul Galaxy
  • DevOps Consulting
  • DevOps Freelancers
  • DevOps Trainer
  • Free Ebooks
  • School for Debugger
  • Holiday Landmark
  • Surgery Planet
  • My Hospital Now
  • My Medic Plus
  • ProfessNow
  • Cotocus
  • Stocks Mantra
  • I Reviewed

Proudly powered by WordPress | Theme: BusiCare by SpiceThemes