Does anyone have any idea how to implement custom validation in Livewire? The documentation shows this example:
$validatedData = Validator::make(
['email' => $this->email],
['email' => 'required|email'],
['required' => 'The :attribute field is required'],
)->validate();
I have a form where I am entering a town/city and a county. I need to validate that the combination entered is unique, i.e. not already in the database. Something like this, but I canāt figure out how to integrate into the Livewire validation which seems to be different from standard Laravel:
Rule::unique('locations')->where(function ($query) {
return $query->where('name', $this->location->name)
->where('county_id', $this->location->county_id);
})
Any pointers would be appreciated.