I try to validate array when form submitted as
<input type="text" class="form-control" wire:model.lazy="data.name" placeholder="name">
//at livewire component class
$data = [
'name' => 'someValue',
'phone' => 'someValue',
'email' => 'someValue'
]
I try this
Validator::make($this->data,[
'name' => 'required',
...
])->validate();
but not working, please help me.
You can validate using the same syntax as you have used in wire:model
:
$this->validate([
'data.name' => ['required'],
]);