Eloquent model attributes as camel case [Laravel 5.2] [Dingo API]
<p>Our Eloquent models have attributes following the Laravel snake case convention.</p>
<p>e.g. <code>first_name</code>, <code>last_name</code> and <code>created_at</code></p>
<p>Although my frontend (react) follows the javascript camel case standard.</p>
<p>e.g. <code>firstName</code>, <code>lastName</code> and <code>createdAt</code></p>
<p>Is there a simple way to convert ALL attributes to camel case when sending an API response?</p>
<p><strong>We are using Larave 5.2 and the Dingo API package.</strong></p>
<hr />
<h1>UPDATE</h1>
<p>Following on from the accepted answer I used the <strong>Custom Response  Format</strong> approach. See the following gist for the implementation (includes unit tests):</p>
<p><a href="https://gist.github.com/andrewmclagan/c5e0fe601d23f3b859b89a9f8922be68" rel="nofollow noreferrer">https://gist.github.com/andrewmclagan/c5e0fe601d23f3b859b89a9f8922be68</a></p>