I have a question and I want to know if it can be resolved with the Request validation method.
I have a table called condando and another that is called locality.
In laravel I am creating a view where once the condando is chosen with a drop-down Select you must write the locality, the idea is to associate the locations with the condandos.
Ex: Dallas would be the location of the county of Texas in the United States.
Then I'm working with the creation of the locality, and as you know in laravel there is the option to create validations using the command:
php artisan make:request nombredelrequest
I have created my validations and so far I have them:
public function rules()
{
return [
'condado_id'=>'required',
'nomb_localidad'=>'required'
]
}
public function messages()
{
return [
'condado_id.required'=>'Necesitamos que elija un condado',
'nomb_localidad.required'=>'Necesitamos el nombre de la localidad'
];
}
So until now I am telling you that it is necessary to have the town and the county, but I would like somehow using this type of validation that if I try to register again the same locality in the same county tell me that it is not possible because I already exists. It may be the case that a locality has a name in one county and exists in another county a locality with the same name that may be possible, I need to validate that if there is already the condando in the locality, do not let me register.