validate email php laravel code example

Example 1: email validation in laravel

'email' => 'required|email|unique:users,email',
//@sujay

Example 2: email validation in laravel

'user.email' => 'required|email|unique:users,email,'.$user->id,
//@sujay

Example 3: php validate email

//BE CAREFUL!!!
//NEVER VALIDATE A EMAIL WITH A NORMAL PREG MATCH
//I SAW THIS A LOT VALIDATING A EMAIL IS THE BEST TO SEND A EMAIL 
//AND VERIFY
//BECAUSE SOMEONE MIGHT HAVE A RIGHT EMAIL THAT DOESNT WORK BECAUSE OF 
//PREG MATCH

Tags:

Php Example