php - Check if the email is valid in a data migration and/or it's real -
two question code made migrate table form old format, many fake emails (not existents), , wrong emails (bad write) application did not check anything.
first, use validation on laravel 5.2 check if old email value detect if email valid email.
all examples see it's use check on form web, not command. all, validate examples of forms, , think it's different because should not included in use
use illuminate\validation\validator; .. $email_wrong = 'ksisks @kikoo'; // how check it's valid email?
second question try search class or example validate if email it's real email.
to validate email can use next function method in class:
/** * check if @param formatted e-mail address. * * @param string $emailtockeck * @return bool */ private function validateemail($emailtockeck) { $my_data = [ 'email' => $emailtockeck, ]; $validator = validator::make($my_data, [ 'email' => 'email', ]); if ($validator->fails()) { return false; } else { return true; } }
Comments
Post a Comment