'Save arrangement to Livewire

I need to save an array generated when I select several input type checkboxes, and I don't know how to do it Laravel Livewire. So, in this section, I select the checkboxes and send them by wire "documentos."

<input wire:model.defer="documentos" name="documentos" type="checkbox" value="Acta"
       class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded">
<label for="acta" class="form-check-label">Acta</label>
<br></br>
<input wire:model.defer="documentos" name="documentos" type="checkbox" value="Documento Ideas"
       class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded">
<label for="ideas" class="form-check-label">Documento Ideas</label>

<input wire:model.defer="documentos" name="documentos" type="checkbox" value="Plan Inversion"
       class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded">
<label for="plan" class="form-check-label">Plan Inversion</label>
</div>

I have the save function in this section, but it only saves one value.

public function guardar()
{
    $data = [
        ['id' => $this->use_id],
        [
            'tarea_paso' => $this->tarea_paso,
            'descripcion_paso' => $this->descripcion_paso,
            'fecha_inicio' => $this->fecha_inicio,
            'fecha_fin' => $this->fecha_fin,
            'id_responsable' => $this->id_responsable,
            'documentos' => $this->documentos,
            'acta' => $this->acta,
            'ideas' => $this->ideas,
            'plan' => $this->plan,
            'acciones' => $this->acciones,
            'poais_id' => $this->metodologia_id,
        ]
    ];
}


Solution 1:[1]

try this

$data = [
            'tarea_paso' => $this->tarea_paso,
            'descripcion_paso' => $this->descripcion_paso,
            'fecha_inicio' => $this->fecha_inicio,
            'fecha_fin' => $this->fecha_fin,
            'id_responsable' => $this->id_responsable,
            'documentos' => $this->documentos,
            'acta' => $this->acta,
            'ideas' => $this->ideas,
            'plan' => $this->plan,
            'acciones' => $this->acciones,
            'poais_id' => $this->metodologia_id,
    ];


Model::where('id', $this->use_id)->update($data);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abdulmajeed