How to check if a combination of isd code and mobile number exists in the users table other than mine, in Laravel 5.6?
Clash Royale CLAN TAG #URR8PPP How to check if a combination of isd code and mobile number exists in the users table other than mine, in Laravel 5.6? While editing an user data, we may keep the email field unchanged so that same email is again submitted. The system needs to check if the email belongs to me (my id and not others). If the email is present in DB and only belongs to me, then it won't give a error message calling it a duplicate email. To make such a validation, I have written this rule, which is working fine:- 'email' => 'required|email|unique:users,email,'.$id, Here, $id is the id of the user. $id In another scenario of adding a new user,I am also checking a combination of isd code and mobile number to see if same mobile with same isd exists in DB or not. If such record exists, then I give a validation message "Duplicate mobile number". Here is the validation rule:- 'isd' => 'required', 'mobile' ...