Illuminate\Contracts\Container\BindingResolutionException Target class does not exist. code example

Example 1: Target class [] does not exist.

composer dump-autoload

Example 2: Illuminate\Contracts\Container\BindingResolutionException target calss does not exist

Routing namespaces have been updated on Laravel 8.X

On your router, you should define:
use App\Http\Controllers\TestController;

And then, declare:
Route::get('test',[TestController::class, 'test']);

Example 3: Illuminate\Contracts\Container\BindingResolutionExceptionTarget class [ProjectController] does not exist.

# ajouter le controller
use App\Http\Controllers\ProjectController;


Route::resource('/projects', ProjectController::class);

Example 4: Illuminate\Contracts\Container\BindingResolutionException Target class [SlugController] does not exist.

Route::get('/test/{slug}',  'App\Http\Controllers\SlugController@show' );

Example 5: Illuminate\Contracts\Container\BindingResolutionException Target class [PagesController] does not exist.

Target class [PagesController] does not exist.

Tags:

Php Example