0

I created API like this Json response.

{
    "product_category_id": 1,
    "branch_id": 1,
    "product_category_code": "00184050",
    "product_Category_name": "books",
    "product_Category_imageURL": "books2.png",
    "product_Category_is_active": 1,
    "product_Category_created_at": "2023-02-25T10:55:48.000Z",
    "product_Category_updated_at": "2023-02-27T14:38:43.000Z",
    "product_Category__created_date": "2023-02-24T18:30:00.000Z",
    "product_Category_Created_by": 1,
    "product_Category_updated_by": 2
}

I need API like this.

{
    "productCategoryID": 1,
    "branchID": 1,
    "productCategoryCode": "00184050",
    "productCategoryName": "books",
    "productCategoryImageURL": "books2.png",
    "productCategoryIsActive": 1,
    "productCategoryCreatedAt": "2023-02-25T10:55:48.000Z",
    "productCategoryUpdatedAt": "2023-02-27T14:38:43.000Z",
    "productCategoryCreatedDate": "2023-02-24T18:30:00.000Z",
    "productCategoryCreatedBy": 1,
    "productCategoryUpdatedBy": 2
}

How To change this to entire application Have any package to method

1 Answer 1

0

You can easily use laraval helper classes.

use Illuminate\Support\Str;
 
$converted = Str::camel('foo_bar');
 
// fooBar

https://laravel.com/docs/8.x/helpers#method-camel-case

Sign up to request clarification or add additional context in comments.

2 Comments

I need to make entire application
You can override the response class in the AppServiceProvider with the alias class and add str camel in the method that is used in the entire project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.