This question already asked but that is not solving my issue.
I have try to use validation in my laravel project. But it not working this is my code
$rules = array(
'coupon_title' => 'max:10',
'coupon_type_id' => 'numaric',
'expiry_start_date' => 'required|before_or_equal:expiry_end_date',
'expiry_end_date' => 'required',
);
$messages = [
'before_or_equal' => 'The :attribute must be smaller than the End Date',
'before' => 'The :attribute must be Greater than the Interview Start Date',
'after' => 'The :attribute must be Greater than the Interview End Date',
'after_or_equal' => 'The :attribute must be Greater than the Start Time',
//'max' => 'asdasd'
];
$validator = Validator::make($request->all(), $rules, $messages);
if ($validator->fails())
{
$messages = $validator->messages();
return response()->json(['message'=>$messages],401);
}
In my code only
expiry_start_datefield validated. Butcoupon_titleandcoupon_type_idfields not validated.
coupon_titleNull yes see this image imgur.com/a/QLtZIW2