How I can return attributes data human friendly for REST API #68
-
As I see product attributes by default return with attribute class name. How I can return attributes human friendly for my REST API? |
Beta Was this translation helpful? Give feedback.
Answered by
alecritson
Jan 18, 2022
Replies: 1 comment
-
What are you looking to get back? If you want to return the value you can just call: $product->translateAttribute('name') If you're using Eloquent Resources then it's easy to map the data exactly how you need it. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
devmansurov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What are you looking to get back? If you want to return the value you can just call:
If you're using Eloquent Resources then it's easy to map the data exactly how you need it.