Answers for "laravel user verify email"

PHP
0

laravel check if email is real

<?php
$email = "[email protected]";

if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
  echo("$email is a valid email address");
} else {
  echo("$email is not a valid email address");
}
?>
Posted by: Guest on April-15-2020
0

username or email validation in laravel

$input = $request->only('account'); // dont use all(), ever
            
$rules = [
  'account' => 'required'
];

if (filter_var($input['account'], FILTER_VALIDATE_EMAIL)) {

  $rules['account'] .= '|exists:users,email';

} else {

  $rules['account'] .= '|exists:users,username';

}

$messages = [
  'account.required' => 'Enter username or email to login.',                
];

$validator = Validator::make($input, $rules, $messages);
Posted by: Guest on April-27-2020

Browse Popular Code Answers by Language