currentPasseggero = $x; $propertyName = 'data_passeggero_' . ($x - 1); if (property_exists($this, $propertyName)) { $this->editAnagrafica($this->{$propertyName}); $this->emit('load-anagrafica-modal'); } } public function removePasseggero($x){ if (!in_array($x, [1, 2, 3, 4])) { return; } $propertyName = 'data_passeggero_' . ($x - 1); if (property_exists($this, $propertyName)) { $this->{$propertyName} = 0; $this->emit('add-default-value', 0, '', $propertyName); } } public function addPasseggero($x){ $this->resetAnagrafica(); $this->currentPasseggero = $x; $this->emit('load-anagrafica-modal'); } }