Saturday, March 4, 2017

How to get existing database row from exists-rule of a laravel validator?

How can I get the value, that was found with exists rule of a Validator?

$validator = Validator::make($request->all(), [
    'invite' => 'required|max:30|exists:invites,code',
]);

I don't want to make a second request to a database, it is already done by the validator.

Invite::where('code', $value)



via shukshin.ivan

Advertisement