If an user is logged in I need to ignore if the email field already exists in the users table. But if the user is not logged in the rule should be applied.
Naturally I only have the user id if the user is logged in. So what is your alternative to this?
public function rules(): array
{
return [
'email' => ['required', 'email:filter', Rule::unique('users')->ignore(Auth::user()->id)],
];
}