Closed noquierouser closed 2 years ago
It appears that Livewire retrieves a 'rut_num' and 'rut_vd' keys instead of 'rut' keys. I assume this is retrieved from the model itself.
There is a chance there is nothing I can do and the bug should be remitted to Livewire repo instead.
I'm still investigating.
Okay, the cause of this is because, when Livewire retrieves the list of attributes from the Model to infuse with the validated data, it believes the validated rut
attribute is on the Model rut
attributes. This is not the case.
This is easily fixed using $appends = ['rut']
to the model.
I'm adding two fixes. One for the validation rule to use parse
instead of check, and another to automatically append the rut
and hide the rut_num
and rut_vd
from serialization.
Ensure you're appending the rut
.
PHP & Platform
8.1.3
Laravel verion
9.3.0
Have you done this?
Expectation
Livewire validation passes (or fails) the
rut
property/cast if a model uses theHasRut
trait.Description
Laravel/Livewire returns a
ErrorException
indicatingUndefined array key "rut"
when attempting real-time validation ($this->validateOnly()
), and clears the<rut>
input field when the$this->validate()
method is executed on form submit.Reproduction
Stack trace & logs
No response
Are you a Patreon supporter?
No, don't give priority to this