Level 3
This might help you: https://laravel.com/docs/8.x/helpers#method-snake-case
I have an entity as shown below
class Entity {
public string uuid;
public string customerName;
......
}
In my controller
$data = collect(new Entity (
'b5b436f6-7a8b-4a5b-ae59-3754517d4ada'
'John'
))->toJson();
When converted into json, it will show {"uuid":"b5b436f6-7a8b-4a5b-ae59-3754517d4ada", "customerName":"John"}', i want it to be {"uuid":"b5b436f6-7a8b-4a5b-ae59-3754517d4ada", "customer_name":"John"}'
Please or to participate in this conversation.