Reputation: 145
I've created my own Route file using AppServiceProvider,
public function boot(){
$this->loadRoutesFrom('routes/test/routes.php');
}
The routes are working but they doesn't found the Controllers
Route::get('/test', 'TestController@test');
ReflectionException (-1) Class TestController does not exist
Maybe I missed something? Thanks in advance.
Upvotes: 0
Views: 180
Reputation: 145
First of all Thanks to vikalp.
It was so easy, I didn´t have to touch AppServiceProvider, the answer was in obviously in RouteServiceProvider.php, I just add my customized route file to mapWebRoutes();
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
/* My route-file */
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/test/test_routes.php'));
}
Upvotes: 0
Reputation: 330
You need to map routes in your RouteServiceProvider.php, Check the example of web routes.
protected function mapWebRoutes()
{
Route::group([
'middleware' => 'web',
'namespace' => $this->namespace,
], function ($router) {
require base_path('routes/web.php');
});
}
Upvotes: 1