Custom rule error

In Livewire I added a custom youtube video validation rule. It works very well, the problem is that I need it to be nullable and if I add in the validate nullable it gives me an error and I can’t find how to solve this problem.

Input:

<input wire:model="video" class="form-control" type="text" placeholder="Url youtube">

Rule:

 public function passes($attribute, $value)
        {
            return (bool) preg_match('/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/',$value);
        }

Validate:

'video' => 'nullable', new RuleYoutube,

Removing nullable works fine, but the field is not required. And with the nullable property I get the following error:

No property found for validation: [0]

Any suggestion? Thank you very much for spending time in my consultation

if ‘video’ property is empty exclude it from validation, and you can use for regex this rule

'regex:/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/'

I think you are forgetting the brackets

'video' => ['nullable', new RuleYoutube,]

Or make sure you are adding the property video at the top of your component

public $video