title: Laravel 5.2: Creating a custom route function - extending route
body: <p>So basically, I want to create my own <code>Route::custom</code> function.</p>
  
  <p>This is because I've been using the same groups and middleware for several routes throughout the site (I'm also using modules with subdomains, so we're talking about saving 5-6 lines of code per route)</p>
  
  <p>All I want is for <code>Route::custom</code> to just call two or three other Route functions. For example:</p>
  
  <p><code>Route::Module('forum')</code> to be replaced with</p>
  
  <pre><code>Route::group(['middleware' =&gt; ['web','auth'], 'domain' =&gt; 'forum.' . env('SITE_DOMAIN', 'example.com')], function () {
      Route::group(['middleware' =&gt; 'permission:access.forum'], function () {
          Route::get('/', function () {
              return view('forum::forum.index');
          })-&gt;name("forum.index");
      });
  });
  </code></pre>