Laravel Funcation unique

'email' => ['required', 'string', 'email', 'max:255',
                Rule::unique('users')->where(function ($query)use($data) {
                    return $query->where('email', $data['email'])->where('type', 2);
                })],
Enchanting Emu