I'm not sure if I explained briefly what's the problem is about. I have a user voting form in which user passes his first name,surname,mothers' surname, and ID.
I have also a table users
which stores all this data. Yesterday I found a bug or I misunderstood how laravel validation works because it passes submit every time when it find all the data existing in table.
This is a table with two records.
EXAMPLE
What i expected from validation was to check if the ID=98111091239 name=Andrzej surname=Pianowski and mother surname =Mila and only if everything is correct and exists in one row then the vote can be made.
Instead i can pass ID from first row, other things from second and it also will allow user to vote. Is that a bug, laravel works that way or what? I'm really looking forward for any tip,help,sugestions.
And here's validation rule i'm using
/*This validates whether all data is correct */
$validator = Validator::make($request->all(),[
//check whether such pesel exists in votes and in voters
'pesel' =>'required|exists:wyborca|max:11|min:11',
'imie' =>'required|exists:wyborca|max:64|min:2',
'nazwisko' => 'required|exists:wyborca|max:128|min:2',
'nazwisko_matki' => 'required|exists:wyborca|max:128|min:2'
]);
if($validator->fails())
{
return back()
->with('errors','Wprowadzono nieprawidłowe dane')
->withInput();
}