Laravel 5.2 Validation Check If Value Is Not Equal To A Variable
In my instance one user is inviting another I would like to check if the user they are inviting is not themselves.
Thus I have two variables incomming email and user->email
$this->validate($request, [ 'email' => 'required|email', ]);
How can I add that validation rule to the validation call?
You can use
not_in, which allows you to specify a list of values to reject:
$this->validate($request, [ 'email' => 'required|email|not_in:'.$user->email, ]);
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?