Laravel Validation Check if value is not equal to a another field

Laravel Validation Check if value is not equal to a another field


tutorials - 5 undefined, 2020

Laravel Validation Check if value is not equal to a another field

In this post, we will learn how to check two value must not be same validation in laravel. we can check using laravel different validation rule. you can use different validation rule for field value should not same in form.

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...

Our Sponsors

NodeJS Experts
React Experts
PHP Experts
AngularJS Experts
Aws Experts
Firebase Experts

Top Applications in TutorialStuff

Top Experts In TutorialStuff

Trending On TutorialStuff