title: Laravel 4 and Backbone not playing well together -- JSON improperly formatted
body: <p>I'm trying to return JSON output from a Laravel route.  Here's my route:</p>
  
  <pre><code>Route::get('main-contact-count', function() {
      $mc = MainContact::where('flag', '=', '1')-&gt;count();
      return Response::json(['count' =&gt; $mc]);
  });
  </code></pre>
  
  <p>If I look at the response tab in Firebug, I'm getting back:</p>
  
  <pre><code>{"count":9}
  </code></pre>
  
  <p>The JSON encoding is missing the square brackets.  This JSON is different than the JSON Laravel returns from a resourceful controller.  It has the square brackets.  Backbone parses it fine.  Backbone doesn't parse the above JSON correctly.  If you look at the length and models when you <code>console.log</code> a collection, they're both zero.  You can, however, drill down into the object and you can find a <code>count</code> property set to 9.</p>
  
  <p>How do I get the correct JSON out of Laravel?</p>
  
  <p>Just for kicks and giggles, I'm posting my Backbone, in case I'm doing something hinky there:</p>
  
  <pre><code>App.Collections.Count = Backbone.Collection.extend({
          model: App.Models.Count,
          initialize: function(models, options) {
              this.fetch({
                  success: function(data, options) {
                      // console.log(data.models);
                  }
              });
              if (options) {
                  this.url = this.url || options.url;
              }
          }
      });
  
      App.Views.Count = Backbone.View.extend({
          tagName: 'span',
          className: 'leadCount',
          template: _.template($('#contactCount').html()),
          initialize: function() {
  
          },
          render: function() {
              this.$el.html(this.template(this.collection.toJSON()));
              return this;
          }
      });
  </code></pre>
  
  <p>And in my route:</p>
  
  <pre><code>var mc = new (App.Collections.Count.extend({ url: 'main-contact-count' }))();
  var mcv = new (App.Views.Count.extend({ collection: mc }))();
  </code></pre>