Download the PHP package wuori/laravel-unique-gmail-validation without Composer
On this page you can find all versions of the php package wuori/laravel-unique-gmail-validation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wuori/laravel-unique-gmail-validation
More information about wuori/laravel-unique-gmail-validation
Files in wuori/laravel-unique-gmail-validation
Package laravel-unique-gmail-validation
Short Description A validation rule to test uniqueness of Gmail addresses with ./+ modifiers.
License MIT
Homepage https://github.com/wuori/laravel-unique-gmail-validation
Informations about the package laravel-unique-gmail-validation
Validate uniqueness of Gmail addresses
Gmail allows two modifiers, +
and .
to be added to your email address without affecting delivery. For example, [email protected]
and [email protected]
both work as valid addresses to the same Gmail account.
The period (.
) modifier can be placed anywhere within your account name, as in the example above.
The plus (+
) modifier can be appended to your account name. Example: [email protected]
.
This validation rule removes any period modifiers as well as any +foo
appendages then compares the address to any existing @gmail.com
emails that exist in the targeted model.
Installation
You can install the package via composer:
The package will automatically register itself.
Using the UniqueGmail Rule
Include the rule:
Attach the rule to an email field, passing the Model you wish to validate against as the first parameter.
If no Model is passed, the rule will default to \App\Models\User
.
This validation rule will pass if the id of the logged in user matches the user_id
on TestModel
who's it is in the model_id
key of the request.
Custom Error Message
By default the UniqueGmail
rule will use Laravel's built-in unique
validation message (trans('validation.unique')
).
You can supply your own message as an entry to the second parameter, $options
:
The custom message accepts two optional attributes to replace:
:existing_email
is replaced with the matching (existing) email address.
:requested_email
is replaced with the email address provided in the request.
Testing
Coming soon...
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.