title: How to make modular system in laravel
body: <p>I am trying to create a modular system in <strong>Laravel 4.1</strong>.</p>
  
  <p>I have folders like following:</p>
  
  <pre><code>app
  app/controllers
  app/controllers/BaseController.php
  app/views/
  app/modules/
  app/modules/moduleName/
  app/modules/moduleName/routes.php
  app/modules/moduleName/controllers/
  app/modules/moduleName/controllers/module.php
  </code></pre>
  
  <p>When I try to extend <code>BaseController</code>, I use namespaces and I get the following error:</p>
  
  <pre><code> Symfony \ Component \ Debug \ Exception \ FatalErrorException
   Class 'Illuminate\Session' not found
  </code></pre>
  
  <p>Here is my module.php codes:</p>
  
  <pre><code> &lt;?php namespace App\Modules\Twitter\Controllers;
  
   use Illuminate\Routing\Controllers\Controller;
  
   class Modulename extends Controller {
  
   }
  </code></pre>
  
  <p>I have two questions.</p>
  
  <ol>
  <li>How can I call session classes in modules?</li>
  <li>I have route.php file in every module but still can't route the
  modules. Hence I am supposed to use laravel default routes.php file.
  How can I solve this problem?</li>
  </ol>
  
  <p>Thanks anyway.</p>