'email' => 'required|email|unique:users,email',
//@sujay
'user.email' => 'required|email|unique:users,email,'.$user->id,
//@sujay
<?php
namespace AppRules;
use IlluminateContractsValidationRule;
class EmailRule implements Rule
{
/**
* Create a new rule instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
return filter_var($value, FILTER_VALIDATE_EMAIL);
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return 'The email format is invalid.';
}
}
'email' => 'email:rfc,dns'
$validator = Validator::make($request->all(), []);
$validator->sometimes('email', 'unique:users,email', function ($input) {
return $input->email !== Auth::user()->email;
});
//@sujay
composer require beyondcode/laravel-confirm-email
Route::name('auth.resend_confirmation')->get('/register/confirm/resend', 'AuthRegisterController@resendConfirmation');
Route::name('auth.confirm')->get('/register/confirm/{confirmation_code}', 'AuthRegisterController@confirm');