Radiobuttons does not return value

Hi
I cant get value from radiobuttons

<div class="col-span-2">
 <span class="text-gray-700">Type</span>
  <div class="mt-2">
  <label class="inline-flex items-center">
   <input type="radio" class="form-radio" value="1" wire:model="type" name="type" id="type">
   <span class="ml-2">Type 1</span>
  </label>
  <label class="inline-flex items-center ml-6">
   <input type="radio" class="form-radio" value="0" wire:model="type" name="type" id="type">
    <span class="ml-2">Type 0</span>
  </label>
 </div>
</div>

in handling class

public function store(Request $request) {
         $this->type = false;
        $type_ = $request->input('type');
         if($type_ == "1")
            $this->type = true;
}

this part of code does not work
trying $type_ = $request->input(); and dd($type_); I see “type” = “1”
but $type_ = $request->input(‘type’); and dd($type_); returns null

Don’t inject the Request interface inside your method in livewire components

return the type directly

public function store()
{
  // if the radio button checked, it returns true, otherways turns false
  dd($this->type) 
}

Thanks for quick reply, but in my setup it returns false, no matter what is choset type1 or type2

PS
type declared as $table->boolean(‘type’);

PSS
Have removed everything connected with $request and it works

Hey, @RizONEnew

I’m glade it works for you.

The reason of the false value is you are setting a default value of a radio button and both shared the same name with false of the last one (radio button), and if you want to make one of them true by default add checked attribute instead.