In this example, you will learn laravel two value must not be same validation. step by step explain Form Validation Combination of Fields Must Be not Unique. you will learn Laravel Validation Check if value is not equal to a another field. you'll learn laravel different validation. Let's see bellow example field value should not same validation in laravel.
You can use that validation with form fields. i will give you controller method with form validation.
This is very small things but it might be need some time to use in laravel application. you can use different validation like as bellow:
Syntax:
different:form_field_name
Example:
different:parent_id
Full Example:
public function mergePost(Request $request)
{
$request->validate([
'primaty_id' => 'required',
'secondary_id' => 'required|different:primaty_id'
]);
dd('You can processed')...
}
I hope it can help you...
Do you like below Tutorials ?
- Multidimensional Array Search By Value in PHP
- Laravel Install Font Awesome Icons Example
- How to Use Moment JS in Laravel?
- Angular 9 Get Environment Variables Example
- Angular Delete a Component From Cli Example
- How to Upload File from Local to Server using SSH?
- Angular Use CKEditor Example Tutorial
- How to Use Multiple Select Dropdown in Laravel?