This forum has moved to a new location and is in read-only mode. Please visit to access the new location.



I'm going a little be crazy with my simple validator.

$data = ['dam' => 1, 'sir' => 2];
        $v = Validator::make(
            ['dam' => 'exists:individuals,id'],
            ['dam.exists' => 'Object not found']

        $validateLab = $v->validate();

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"?


Last updated

1-1 of 1

You cannot edit posts or make replies: the forum has moved to