How to bind selected values of checkbox to livewire component array

What seems to be the problem:
Hello, Could anybody help me to solve following issue, I am trying to bind only selected checkbox values to array in my livewire component as below, but it does not work

Steps to Reproduce:

Are you using the latest version of Livewire:

Do you have any screenshots or code examples:
Component

use Livewire\Component;
use App\Point;

class AddNewTrip extends Component
{
   
    public $selectedtypes;

    public $initial_cargo_types;;


    public function mount($cargoTypes)
    {
        $this->initial_cargo_types = $cargoTypes;
    }

}

Blade

@foreach($initial_cargo_types as $type)
       <div class="mt-1">
              <label class="inline-flex items-center">
		      <input type="checkbox" value="{{ $type->id }}" wire.model="selectedtypes"  class="form-checkbox h-6 w-6 text-green-500">
                   <span class="ml-3 text-sm">{{ $type->name }}</span>
               </label>
          </div>
 @endforeach

Try, wire:model instead of wire.model.

Hello, thank you for your reply, it helped me.
So stupid mistake :man_facepalming:

2 Likes