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

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

In this post we will give you information about Laravel Validation Check if value is not equal to a another field. Hear we will give you detail about Laravel Validation Check if value is not equal to a another fieldAnd how to use it also give you demo for it if it is necessary.

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:

Also see:How to get latitude longitude from mysql in Laravel?

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…

Hope this code and post will helped you for implement Laravel Validation Check if value is not equal to a another field. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

44  +    =  46

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US