0

I want to check data exist in mysql column if already exist show error message and not exist insert input data with laravel 5.2 Validator exists(database)
There's my Code.

$validator = Validator::make($input, array('CardKeyCode' => 'exists:customer,CARDNO'));
if ($validator->passes()) {
      $ok = CustomerMaster::insert($input);
} else {
     return redirect('CustomerMaster/New')->withErrors("CardNo Already Exist!!");
}

Thanks!!! :D

Bibhudatta Sahoo
  • 4,808
  • 2
  • 27
  • 51
Khant Zin
  • 27
  • 1
  • 2
  • 10

0 Answers0