title: Laravel dynamic routing performance issue
body: <p>I wonder if there is any performance issue with regards to dynamically loading routes via database.</p>
  
  <p>In the <code>routes.php</code>, it will retrieve values from the database and create the routing from there.</p>
  
  <p>From the <code>routes.php</code>:</p>
  
  <pre><code>buildDynamicRoutes(new App\Factory\ModelFactory('App\Models\RoutingModel'));
  
  function buildDynamicRoutes($model)
  {
      $routes = $model-&gt;getInstance()-&gt;getRoutes(); // 'routes' is the table name wherein routes will be stored.
      if (is_array($routes) &amp;&amp; !empty($routes)) {
          foreach ($routes as $route) {
              Route::resource($route['url'], 'DynamicController');
          }
      }
  }
  </code></pre>
  
  <p>So basically, on the <code>buildDynamicRoutes</code> method, it will call the ModelFactory that instantiates the <code>RoutingModel</code> class. Once instantiated, it will connect to the API thru the <code>getRoutes()</code> method that will return the routes result.</p>
  
  <p>From there, it will build the <code>Route::resource</code> base on the <code>$route['url']</code> returned which will use the <code>DynamicController</code>.</p>
  
  <p>Having this structure, will there be any performance issue with regards to routing or loading the web app? I'm asking this because I notice that my web app seems to load very slow, around 10-18 seconds page load.</p>
  
  <p>I recently upgraded from Codeigniter to Laravel 5.2 and notice the drastic performance issue upon switching to Laravel. When I was previously using Codeigniter, the page loads in about 2-4 seconds only. Notice the huge difference it made.</p>
  
  <p>Same logic, just re-write the code base on Laravel's standards.</p>