Answers for "custom user email verification in laravel"

PHP
3

laravel 8 register with email verification

LARAVEL 8 : ENABLE EMAIL VERIFICATION FOR REGISTRATION
-------------------------------------------------------
  
(1) Modify the Verification controller found in
app > Http > Controllers > Auth > VerificationController

*Update below class;

FROM :

Class User Extends Authenticatable
{
...
}

TO :

Class User Extends Authenticatable implements MustVerifyEmail
{
...
}


(2) Add the below code in the web.php route file;
Auth::routes(['verify' => true]);


(3) Add the below code in the Middleware section of your Controllers
$this->middleware(['auth', 'verified']);

Thats all, the next registration will require an email confirmation
Posted by: Guest on July-24-2021
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

Code answers related to "custom user email verification in laravel"

Browse Popular Code Answers by Language