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

By Hardik Savani | July 25, 2019 | Category : Laravel

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 in laravel 6, laravel 7 and laravel 8 application.

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:





Full Example:

public function mergePost(Request $request)



'primaty_id' => 'required',

'secondary_id' => 'required|different:primaty_id'


dd('You can processed')...


I hope it can help you...

Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: