Hello. I have two components and I need to pass data from one to the other. The problem is that this data arrives at component B as an array and not as an object. Can I change that?
Component A
public $datai, $dataf;
public function submit(): void
{
$validate = $this->validate([
‘datai’ => ‘required’,
‘dataf’ => ‘required’
]);
$services = (new ServicoRepository(new SERVICO()))->servicesFilter($this->datai, $this->dataf);
dd($services) -- so far is a collection
$this->emit('services', $services);
}
Component B
public $services = [];
protected $listeners = [‘services’];
public function services($services): void
{
dd($services) – here it becomes an array
$this->services = $services;
}
How to solve this? Thanks. I appreciate help.