You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use Laravel Data for my CRUD methods and I want to update my existing model which has a Unique attribute.
However, when passing all of the inputs from the frontend form using validateAndCreate on my Data class I get an error, rightly so, mentioning that I can't use the same Unique value.
Is there a way of passing in the model reference or something so that I can validate correctly for new models, as well as updating existing models? I do also want a unique check for updating, as if you change this value it still shouldn't have the value of a differing entry
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to use Laravel Data for my CRUD methods and I want to update my existing model which has a
Unique
attribute.However, when passing all of the inputs from the frontend form using
validateAndCreate
on my Data class I get an error, rightly so, mentioning that I can't use the same Unique value.Is there a way of passing in the model reference or something so that I can validate correctly for new models, as well as updating existing models? I do also want a unique check for updating, as if you change this value it still shouldn't have the value of a differing entry
Any help would be appreciated!
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions