0

I have the following validation rules in controller for email validation. But it takes domain name twice or more like something@gmail.com.com

  $rules = [
 'email' => 'required|email|unique:users'
   ];
 $validator = Validator::make(Input::all(), $rules);
    if ($validator->fails()) {
        return redirect()->back()->withErrors($validator)->withInput();
    }

My form.blade.php is

<div class="form-group">
  <label for="">Email </label>
 <input type="email" class="form-control" name="email" placeholder="Enter mail ID"/>
</div>

I want to restrict domain name to one like something@gmail.com not something@gmail.com.com

Thanks

Sohel0415
  • 9,523
  • 21
  • 30

1 Answers1

1

Please sent verification email after complete necessary validation in JS and PHP.

Tuhin Bepari
  • 725
  • 5
  • 11
  • currently i am doing it after saving data to database. But is there anyway to validate the existent of email before save to database? – Sohel0415 Jul 24 '16 at 07:18
  • 1
    please follow this post http://stackoverflow.com/questions/565504/how-to-check-if-an-email-address-exists-without-sending-an-email – Tuhin Bepari Jul 24 '16 at 07:22
  • Get the domain name of that email. like something@gmail.com here domain name is gmail.com Then sent a request to www.gmail.com if response code is 200 then domain exists and that means email address is valid. – Tuhin Bepari Nov 23 '17 at 15:11