title: Passing optional parameter value from laravel route to controller
body: <p>How can I pass optional parameter from laravel route to controller? I am using:</p>
  
  <pre><code>Route::get('test/{id?}', function($id = 5){});
  </code></pre>
  
  <p>But it is not working...</p>
  
  <p><strong>Update: Laravel version 4</strong> </p>
  
  <p>Code is working now but my Backbone.js script which is in my view don't work. It will not fetch data from server (returning error).</p>
  
  <p>Route:</p>
  
  <pre><code>Route::get('test/{id?}', 'TestController@index', function ($id = 5) {});
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public function index()
  {
      $pitanja = DB::select('select * from pitanja ORDER BY RAND() LIMIT 15');
      $znakovi = DB::select('select * from znakovi ORDER BY RAND() LIMIT 15');
  
      Cache::forever('pitanja', $pitanja);
      Cache::forever('znakovi', $znakovi);
  
      return View::make('test.index', compact('pitanja'), compact('znakovi'));
  }
  </code></pre>
  
  <p>When my URL is <code>/test/4</code> my Backbone.js code won't fetch from server (from this function) :</p>
  
  <pre><code>public function pitanja()
  {
      $pitanja =  Cache::get('pitanja');
      return $pitanja;
  }
  </code></pre>
  
  <p>(URL in Backbone.js controller is <code>url:'/testovi/pitanja'</code>)</p>