laravel rule unique where 1

laravel rule unique where

'required|email|unique:company_users,email_address,NULL,id,company_id,' . $request->company_id

Here is what the above code is Doing:
1. The first rule is saying that the email_address field is required.
2. The second rule is saying that the email_address field must be a valid email address.
3. The third rule is saying that the email_address field must be unique in the company_users table, but only for the company_id that is being passed in the request.

Similar Posts