You can validate that a combination of columns is unique in Laravel using the unique validation rule. To validate a combination of columns, you need to pass the name of the table and the columns to the unique rule, separated by a comma.
Here is an example of using the unique rule to validate a combination of columns:
$request->validate([
'email' => 'required|email|unique:users,email,' . $user->id,
'username' => 'required|unique:users,username,' . $user->id,
]);
In this example, the validation rule is checking if the email and username fields are unique in the users table, and ignoring the current user with the ID of $user->id. The unique rule accepts an optional fourth parameter, which is the ID of the model that should be excluded from the uniqueness check.
Note that the unique validation rule will only check the database, and not the current set of loaded models.