I’have this component, for which, wire:model
is used to bind to email and open
is called trough an event from another component. What I’m sadly seeing, is the $kid_id
variable that’s set in the open
event, be reset once I start typing, to the default 1… Is there any way to avoid this reset?
<?php
namespace App\Http\Livewire;
use App\Kid;
use Livewire\Component;
class FulfillmentConfirmationModal extends Component
{
public $isOpen = false;
public $email = "";
protected $listeners = ['showModal' => 'open', 'closeModal' => 'close', 'confirm' => 'fulfill'];
private $kid_id = 1;
public function fulfill($id) {
$kid = Kid::find($id);
dump($kid);
}
public function close() {
$this->isOpen = false;
}
public function open($selected_kid) {
$this->kid_id = $selected_kid;
$this->isOpen = true;
}
public function render()
{
return view('livewire.fulfillment-confirmation-modal', [
"kid" => Kid::find($this->kid_id),
]);
}
}