This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Greg
Hello,
I'm going a little be crazy with my simple validator.
$data = ['dam' => 1, 'sir' => 2];
//dd($data);
$v = Validator::make(
$data,
['dam' => 'exists:individuals,id'],
['dam.exists' => 'Object not found']
);
$validateLab = $v->validate();
dd($validateLab);
In the table individuals, there is an entry for id=1, but not id=2. If I run the code as it is, I get "true". If I change 'dam' => 1 to 'dam' => 2, I get "The given data was invalid." on line 306 of /Applications/MAMP/htdocs/mysamples/vendor/laravel/framework/src/Illuminate/Validation/Validator.php.
Why? Why it does not return "Object not found"?
Thanks,
Last updated
1-1 of 1