I have been trying to set custom error messages for fields validation in laravel controller.
I have set the custom messages but i can't figure out how to make Rule::in field work.
I am pasting the controller below .
public function registerNewAnkda(Request $request)
{
$attr = $request->validate([
'game_id' => ['required','numeric'],
'market' => ['required',Rule::in(['Kalyan', 'Time','Ratan','Main','Milan'])],
'DoN' => ['required',Rule::in(['Day', 'Night'])],
'OoB' => ['required',Rule::in(['Open', 'Bandh','Jodka'])],
'type' => ['required',Rule::in(['Ankda'])],
'selection' => ['required','numeric',Rule::in(['0', '1','2','3','4','5','6','7','8','9'])],
'stake_amt' => ['required','numeric'],
'to_win_amt' => ['required','numeric'],
],
//Below code is used to display custom validation error messages!
[ 'game_id.numeric' => 'The :attribute should be Unique and Numeric ! MSG FOR PINKA !',
'selection' => 'Rule::in should be Single Number ! E.G - 0,1,2,3,4,5,6,7,8,9'
]
);
The Rule::in field custom message is not displaying ! so any help is appreciated !