route controllers in subfolder

example route.php.As long as you don’t change the namespace of the controller you should be able to access it from the global namespace even if it is in a subfolder.

Route::group(array('prefix' => ''), function()
{
     Route::get('/','MainController@getIndex');
});

app/controllers/landing/MainController.php (subfolder is landing)

class MainController extends BaseController {
    public function getIndex()
    {
        return View::make('landing.index');
    }

}

For access from global. You must done composer dump-autoload after you have created the controller.

Related posts:

This entry was posted in laravel4. Bookmark the permalink.