In Laravel, how do I validate an email address and force it to have a suffix like g.go.edu
?
Asked
Active
Viewed 6,556 times
5

Sheepy
- 17,324
- 4
- 45
- 69

Witairsturs
- 51
- 1
- 2
-
2Are you using laravel 4 or 5? You can't be using both... – Jon Egeland Apr 19 '15 at 18:41
-
I have reworded the question and title to make it easier to read. – Sheepy Apr 22 '15 at 11:06
-
Does this answer your question? [Laravel:custom validation for email](https://stackoverflow.com/questions/41933019/laravelcustom-validation-for-email) – Tiago Martins Peres Mar 19 '21 at 10:59
1 Answers
9
If you want to accept all emails that have suffix g.go.edu
, you can use as rule both email
and regex
rules, for example:
$rules['email'] = ['email', 'regex:/(.*)g\.go\.edu$/i'];

Marcin Nabiałek
- 109,655
- 42
- 258
- 291