title: How to handle routing in laravel modular application
body: <p>I know there are question/answer for routing in modules. But i have tried all that but i can't get any workaround.</p>
  
  <p>Let me show what i have done.</p>
  
  <p>My folder structure</p>
  
  <p><a href="https://i.stack.imgur.com/KF9Cv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KF9Cv.png" alt="enter image description here"></a></p>
  
  <p>My ModuleServiceProvider.php</p>
  
  <pre><code>namespace App\Modules;
  
  class ModulesServiceProvider extends \Illuminate\Support\ServiceProvider
  {
      /**
       * Will make sure that the required modules have been fully loaded
       * @return void
       */
  
      public function boot()
      {
  
          if ($module = $this-&gt;getModule(func_get_args())) {
               include __DIR__.'/'.$module.'/routes.php';
          }
          $this-&gt;loadViewsFrom(__DIR__.'/'.$module.'/Views', 'core');
      }
  
      public function register()
      {
          if ($module = $this-&gt;getModule(func_get_args())) {
  
          }
      }
  
      public function getModule($args)
      {
          $module = (isset($args[0]) and is_string($args[0])) ? $args[0] : null;
  
          return $module;
      }
  }
  </code></pre>
  
  <p>My BlogServiceProvider.php</p>
  
  <pre><code>namespace App\Modules\Blog;
  
  class BlogServiceProvider extends \App\Modules\ModulesServiceProvider {
  
      public function register()
      {
          parent::register('Blog');
      }
  
      public function boot()
      {
          parent::boot('Blog');
      }
  }
  </code></pre>
  
  <p>in app\config\app.php</p>
  
  <p><code>'App\Modules\Blog\BlogServiceProvider',</code> //added in providers array</p>
  
  <p>in app\config</p>
  
  <p>module.php created</p>
  
  <pre><code>return  [
      'modules' =&gt; [
         'Blog',
      ]
  ];
  </code></pre>
  
  <p>in composer.json </p>
  
  <pre><code>"autoload": {
          "classmap": [
              "database",
              "app/Modules"
          ],
          "psr-4": {
              "App\\": "app/",
               "Modules\\": "Modules/"
          }
      },
  </code></pre>
  
  <p>Everything seems perfect but in i trapped in routes.</p>
  
  <p>in my app\Modules\Blog\routes.php </p>
  
  <pre><code>    Route::group(['namespace' =&gt; array('Modules\Blog')], function() {
        Route::get('/',['as' =&gt; 'home', 'uses' =&gt; 'PostController@index']);
      });
  Route::get('/', ['as' =&gt; 'home', 'uses' =&gt; 'App\Modules\Blog\Controllers\PostController@index']);
  </code></pre>
  
  <p>I m getting PostController doesn't exist error</p>
  
  <p>My controller namespace</p>
  
  <pre><code> namespace App\Modules\Blog\Controllers;
  </code></pre>
  
  <p>I am getting that error on both route. whether i specify controller path or not. any help please. How to route in modular application. </p>