How to validate input value in livewire?

I want to make Up/Down buttons working.

Please check my code it is so simple …

in view

<div wire:click="ThumbsUp( $video_id, 'up' )" >

<div wire:click="ThumbsDown( $video_id, 'down' )" >
Thumb Down

in livewire component.

function thumbsUp( $video_id, $up_down ){
    $validatedData = $this->validate([
        'video_id' => ['required', 'integer'],
        'up_down' => ['required', 'in:up,down'],

function thumbsDown( $video_id, $up_down ){
    // ... same with up 

It goes error.

No property found for validation: [video_id]
// or without video_id 
No property found for validation: [up_down]

I guess I don’t need forms.

and it should be two forms if used. So

protected $rules = [] ;;

Would not useful.

How to validate input in livewire component ?

Hey, @bingglex

You can do manual validation in this case like so:

function thumbsUp($videoId, $upDown) {
   if (!empty($videoId) || is_int($videoId) {
     return $this->addError('error', 'your video id is not valid');

   if (!empty($upDown) || in_array($upDown, ['up', 'down'])) {
      return $this->addError('error', 'Your up down is not valid');

Maybe you can come up with a better solution then mine like custom validation or something like that.