Validation using Laravel, inertia.js, vue3 & typescript #852
Unanswered
pefremidis
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I need some guidance to finish up with the new architecture using laravel data and typescript transformer.
The case is pretty simple.
I am building a create form for a Credit model that consist of other model for example a Supplier. (a Supplier belongs to a Credit)
My initial approach was to create a CreditData and a CreditRequestData.
After thought I realized that all the fields that lived inside CreditRequestData were actually a subset of fields of CreditData.
So it felt more appropriate to me to only have one Data class that relates to my model that is responsible of transforming my data as well as validate them.
I tried two approaches
First
CreditData.php
CreditController.php
Create.vue
response
the above response would be great if it had the
supplier
key as well.This is a problem because I have
form.errors.supplier
and it needsform.errors['supplier.id']
which is not ok with typescript as it assumes that form.errors only has thesupplier
keyI could simply ignore this but I feel I am so close
Thank you very much
Beta Was this translation helpful? Give feedback.
All reactions