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

前端 未结 9 1129
广开言路
广开言路 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:04

    If you just want to create a custom route file you can easily add your custom route file and register by using the web middleware name. The code is pretty simple like this.

    Edit App\Provider\RouteServiceProvider.php

       public function map()
       {
        /** Insert this Method Name **/
            $this->methodicalness();
       }
    
       protected function methodicalness()
       {
           Route::middleware('web')
           ->namespace($this->namespace)
           ->group(base_path('routes/yourRouteName.php'));
       }
    

    Note: This method also works even the file is inside the folder just trace where your route file located.

    Happy Coding.

提交回复
热议问题