-
Hi! In my case I have a name but that name would be the id if it is slugified. So is their a way I can create a id property that is automatically computed of the name property with the Str::slug option? |
Beta Was this translation helpful? Give feedback.
Answered by
Nir-An
Sep 1, 2022
Replies: 1 comment 1 reply
-
Hi @gitdevries I think it could be local cast: https://spatie.be/docs/laravel-data/v2/as-a-data-transfer-object/casts#content-local-casts also, you can use transformers: https://spatie.be/docs/laravel-data/v2/as-a-resource/transformers |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
rubenvanassche
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @gitdevries
I think it could be local cast:
https://spatie.be/docs/laravel-data/v2/as-a-data-transfer-object/casts#content-local-casts
https://spatie.be/docs/laravel-data/v2/advanced-usage/creating-a-cast
also, you can use transformers:
https://spatie.be/docs/laravel-data/v2/as-a-resource/transformers