01/04
2017
dev-master
9999999-devValidation of disposable e-mails for Laravel 5
MIT
The Requires
by Daniel Rubin
Validation of disposable e-mails for Laravel 5
This repo uses ivolo/disposable-email-domains to update the black list., (*1)
composer require dann95/l5-disposable-emails-validation
[ //... App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, Dann95\L5DisposableEmails\Providers\DisposableEmailsServiceProvider::class /* add it here */ //... ],
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'email' => ['required','email','real_email'], ]; } /** * @return array */ public function messages() { return [ 'email.real_email' => 'Sorry you are using temporary e-mail', ]; }
public function store(Request $request) { $this->validate($request, [ 'email' => 'required|email|real_email', ]); // the email is valid }
$validator = Validator::make(request()->all(), [ 'email' => 'required|email|real_email', ]); if ($validator->fails()) { // it fails }
Validation of disposable e-mails for Laravel 5
MIT