I have 2 columns in table servers.
I have columns ip
and hostname
.
I have validation:
'data.ip' => ['required', 'unique:servers,ip,'.$this->id]
This working only for column ip
. But how to do that it would work and for column hostname
?
I want validate data.ip with columns ip
and hostname
.
Because can be duplicates in columns ip and hostname, when user write ip.
You can use
Rule::unique
to achieve your validation ruleedit: Fixed message assignation