Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4.2 to 5 Class 'App\Http\Controllers\Controller' not found

I upgraded my project from Laravel 4.2 to 5.0 but I get this error when I finish the process:

Class 'App\Http\Controllers\Controller' not found' in .../app/Http/Controllers/Auth/AuthController.php:8

But the mentioned controller is there, in app/Http/Controllers/Controller.php.

Also it is defined in composer.json, autoload, classmap:

"autoload": {
        "classmap": [
            "database",
            "app/Http/Controllers",
            "app/Libraries"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },

Apparently this is a namespace problem, but I don't know hot to solve it

like image 801
Paulo Coghi Avatar asked Mar 16 '23 16:03

Paulo Coghi


1 Answers

In 99% of the cases the main cause of classes being not found when you migrate a Laravel 4 project to Laravel 5 is the lack of Namespaces

It is important to add namespaces to all your classes, controllers, old filters as middleware, etc.

like image 183
Paulo Coghi Avatar answered Apr 01 '23 07:04

Paulo Coghi