Can you post your whole class file for GetClientsDetails?
There’s not an awful lot in a resource file so would be interested in getting a fuller picture..
What version of laravel are you in?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am trying to use a resource for filtering out information from a API call I don't need.
My Resource is called GetClientsDetails, it contains the following:
return [
'firstname' => $this->firstname,
'client_id' => $this->client_id,
];
In my controller I am applying it to a API call's body contents.
$response = new GetClientsDetails($api->call('GetClientsDetails'));
However, it's not working correctly and returning the entire API call, instead of firstname, and client_id.
The API Call returns in DD:
{#293 ▼
+"result": "success"
+"userid": 53
+"client_id": 53
+"id": 53
+"owner_user_id": 51
+"uuid": "xxx"
+"firstname": "xxx"
+"lastname": "xxx"
+"fullname": "xxxxxx"
+"companyname": "xxx"
+"email": "[email protected]"
+"address1": "xxxx"
+"address2": ""
+"city": "Worksop"
+"fullstate": "xxx"
+"state": "xxx"
+"postcode": "xxx"
+"countrycode": "GB"
+"country": "GB"
+"phonenumber": "xxx"
+"tax_id": ""
+"statecode": "xxx"
+"countryname": "United Kingdom"
+"phonecc": 44
+"phonenumberformatted": "+xxx"
+"telephoneNumber": "xxx"
+"billingcid": 0
+"notes": ""
+"currency": 1
+"defaultgateway": ""
+"cctype": "xxx"
+"cclastfour": "xxx"
+"gatewayid": "{"customer":"xxx","method":"xxx"}"
+"groupid": 0
+"status": "Active"
+"credit": "0.00"
+"taxexempt": false
+"latefeeoveride": false
+"overideduenotices": false
+"separateinvoices": false
+"disableautocc": false
+"emailoptout": true
+"marketing_emails_opt_in": false
+"overrideautoclose": false
+"allowSingleSignOn": 1
+"email_verified": false
+"language": ""
+"isOptedInToMarketingEmails": false
+"lastlogin": "Date: 01/01/2021 21:21<br>IP Address: xxx<br>Host: host86-186-55-17.range86-186.xxx.com"
+"currency_code": "GBP"
}
How do I get this working?
Please or to participate in this conversation.