Target Class Does Not Exist in Laravel 8

Target Class Does Not Exist in Laravel 8

If you need to see an example of target class does not exist in laravel 8. you will learn Target class class no laravel 8. step by step explain target class no exist in laravel 8. I will show you with target class not found in laravel.

Just yesterday laravel 8 was launched and I was trying to create my first system with laravel 8 and when I made the controller call UserController and when I used the track I found the following problem:

Read Also :  Laravel Livewire Click Event Example

Target category [UserController] does not exist

you can see the bellow screenshot too.

Actually this is not a mistake but laravel 8 has removed the RouteServiceProvider.php space name form. but i will mention this nice feature if you want to call your control section from a different name area.

but now if you want to find a solution I will give you two solutions. you can use it in the route file or you can specify the default namespace in the RouteServiceProvider.php file. let’s see both solutions one by one.

Read Also :  How to Search Comma Separated Values in Laravel

Step for Target Class Does Not Exist in Laravel 8

Step :1 routes/web.php


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


Step : 2 UserController.php

  namespace App\Http\Controllers;
  class UserController extends Controller {

  function user(){
    return view("welcome");

Step : 3 welcome.blade.php

<!doctype html>
<meta charset="utf-8">
<title>Laravel Flash Message Tutorial</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//">

<!-- Optional theme -->
<link rel="stylesheet" href="//">

<!-- Latest compiled and minified JavaScript -->
<script src="//"></script>


 <div class="container">

     <h1>Laravel Flash Messages</h1>

I hope it can help you…

Read Also :  Laravel Insert Data into Table without Model