Home php Laravel Target Class Does Not Exist

Laravel Target Class [TaskController] Does Not Exist

Author

Date

Category

Recently 8 version of Laravel came out.
Using Composer Global Require Laravel / Installer put the latest version of Laravel.
Create a controller using PHP Artisan Make: Controller Taskcontoller and make it the standard index method, which returns View Welcome .
I registered it all in Rout, but I get an error

illuminate \ contracts \ CONTAINER \ BindingResolutionException
Target Class [TaskController] Does Not Exist.

TaskController

& lt;? php
Namespace App \ HTTP \ Controllers;
Use illuminate \ http \ request;
Class TaskController EXTENDS Controller
{
  Public Function Index ()
  {
    RETURN VIEW ('WELCOME');
  }
}

Web.php

& lt;? php
Use Illuminate \ Support \ Facades \ Route;
Route :: Get ('/', 'TaskController @ index');

Answer 1, Authority 100%

answer from English stackoverflow

Web.php

& lt;? php
Use Illuminate \ Support \ Facades \ Route;
Use App \ http \ controllers \ taskcontroller;
Route :: Get ('/', [TaskController :: Class, 'index']);

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions