Reputation: 12909
I'm working on Laravel 6 and my request message error for exists
clause is not working at all.
Request:
public function rules()
{
return [
'coupon_code' => 'required|exists:coupons,coupon_code'
];
}
public function messages()
{
return [
'coupon_code.required' => 'is required',
'coupon_code.exists' => 'not found',
];
}
I'm sure that the request doesn't pass, and also that the query is done without problem (I log every query and i can see the one done by the validator and it works perfectly)
What should i check? I already do json_decode($errors)
on my page and it contains any error.
PS: the required
clause don't works fine also...
Upvotes: 0
Views: 753
Reputation: 12909
Turns out it was a previous ->withErrors([])
that was in conflict with redirect()->back()
of the validator, don't know why, but after removed it,
no more mistakes have been seen
Upvotes: 0