I'm having trouble getting the Validator to work with the rule that I want to set up. I could have made multiple tables, but it's going to be a lot of work to undo everything, so I'd prefer to make it work if possible.
$validator = Validator::make($input, [
'segment_name' => [
'required',
Rule::unique('groups')->where(function ($query) {
$query->where('lang', $list_name)->where('segment_name', 'auto_segment');
}),
],
]);
I thought query was the way to do it, but I now realise that this adds another constraint instead. What I want is the validation to fail when the 2 query conditions are met, but otherwise then it should pass. Is there any easy way to do this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire