Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Laravel Basics MVC (View) Creating a Blade

Dario Preglej
Dario Preglej
9,771 Points

Target class does not exist

I got error: target class does not exist, and i spent few hours trying to look for every character in my code as i tough i wrote something wrong. Then i google it and i found out that in Laravel 8 you need to write route differently, like this:

Route::get('/', 'App\Http\Controllers\AppController@index');

This solve my problem.

Hello, also for this problem and in case you do want to keep using Laravel 8 for whatever reason, this guy explains how to reverse the changes done in Laravel 8, for it to behave like Laravel 6 and 7 in that regard.

https://www.youtube.com/watch?v=MfE1tnMG6fE

Also there is this stack Overflow article talking about this: https://stackoverflow.com/questions/63807930/target-class-controller-does-not-exist-laravel-8

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Dario Preglej! Yes, that's correct. Laravel 8 changes the namespacing somewhat. I updated the Teacher's Notes to include instructions on how to install Laravel 6 when taking this course to avoid this confusion in the future. Let's hope that between the Teacher's Notes and your answer that the confusion is significantly lessened.

To be clear, Laravel 6 is the latest LTS (long-term support) version of Laravel and should be used both for this course and the Laravel API course :smiley:

Thanks for the information regarding Laravel 8 changes! :sparkles: