Laravel 5 directly manage call controller

I am trying to call a controller directly in routes.php in Laravel 5 like this:

    Route::get('/', function()
{

    if (\Auth::guest()){
        $controller = new \App\Http\Controllers\ConstructorController;
    }else{
        $controller = new \App\Http\Controllers\HomeController;
    }

    return $controller->index();
});

      

However, I am getting the following error:

FatalErrorException on route.php line 109: Class 'HomeController' not found

What am I missing?

thank

+3


source to share


1 answer


try to do composer dump-autoload



0


source







All Articles