multiple route file instead of one main route file in laravel 5

前端 未结 9 1137
广开言路
广开言路 2020-12-15 12:58

I am a novice in web developing with Laravel 5. I installed asGgardCMS and After seeing asgardCms codes, I found that there is nothing codes in app/Http/route.php file and r

9条回答
  •  没有蜡笔的小新
    2020-12-15 13:29

    You can create as many route files as you need anywhere and then just require them in the main route file smth like:

    Route::get('/', function () {
        return 'Hello World';
    });
    
    Route::post('foo/bar', function () {
        return 'Hello World';
    });
    
    require_once "../../myModule1/routes.php";
    require_once "../../myModule2/routes.php"
    require_once "some_other_folder/routes.php"
    

    where you will define routes in the same way as in main

提交回复
热议问题