title: Why does Eloquent change relationship names on toArray call?
body: <p>I'm encountering an annoying problem with Laravel and I'm hoping someone knows a way to override it...</p>
  
  <p>This is for a system that allows sales reps to see inventory in their territories. I'm building an editor to allow our sales manager to go in and update the store ACL so he can manage his reps.</p>
  
  <p>I have two related models:</p>
  
  <pre><code>class Store extends Eloquent {
  
      public function StoreACLEntries()
      {
          return $this-&gt;hasMany("StoreACLEntry", "store_id");
      }
  
  }
  
  class StoreACLEntry extends Eloquent {
  
      public function Store()
      {
          return $this-&gt;belongsTo("Store");
      }
  
  }
  </code></pre>
  
  <p>The idea here is that a <code>Store</code> can have many entries in the ACL table.</p>
  
  <p>The problem is this: I built a page which interacts with the server via AJAX. The manager can search in a variety of different ways and see the stores and the current restrictions for each from the ACL. My controller performs the search and returns the data (via AJAX) like this:</p>
  
  <pre><code>$stores = Store::where("searchCondition", "=", "whatever")
      -&gt;with("StoreACLEntries")
      -&gt;get();
  
  return Response::json(array('stores' =&gt; $stores-&gt;toArray()));
  </code></pre>
  
  <p>The response that the client receives looks like this:</p>
  
  <pre><code>{
      id: "some ID value",
      store_ac_lentries: [
          created_at: "2014-10-14 08:13:20"
          field: "salesrep"
          id: "1"
          store_id: "5152-USA"
          updated_at: "2014-10-14 08:13:20"
          value: "salesrep ID value"
      ]
  }
  </code></pre>
  
  <p>The problem is with the way the <code>StoreACLEntries</code> name is mutilated: it becomes <code>store_ac_lentries</code>. I've done a little digging and discovered it's the <code>toArray</code> method that's inserting those funky underscores.</p>
  
  <p>So I have two questions: "why?" and "how do I stop it from doing that?"</p>