Controller Route subfolder

Posted 8 months ago by MichielElshout

Hi all,

I was wondering something. I splitted up my controllers in 2 additional subfolders.

/Controllers

/Controllers/Front/MainController.php

/Controllers/Admin/

I made a grouped route and everything seem to work fine. To let the controller work, I have to use use App\Http\Controllers\Controller; in every controller. Is there a way that I only have to set up this once and everything else will automaticly be registred? It seems kind of unnecessesary to use that single line in each Controller file.

web.php

Route::namespace('Front')->group(function () {
    Route::get('/', '[email protected]');
})

Please sign in or create an account to participate in this conversation.