I'm getting data of a specific contact using his id
as following :
<span wire:click="confirmContactEdit({{$contact->id}})" wire:loading.attr="disabled">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"></path>
</svg>
</span>
When displaying his infos, I only have info of the contact table, and not the entreprise table. And when I remove Contact $contact
and $this->contact = $contact;
I have the infos of the entreprise displaying alone without the contact. So either one of them is displaying at at time.
Contact.php
public function confirmContactEdit(Contact $contact, Entreprise $entreprise){
$this->contact = $contact;
$this->entreprise = $entreprise;
$this->confirmingContactAdd = true;
}
If your method is required with two parameters but through the blade you're only want to pass it one you can do this
// in the blade
<span wire:click="confirmContactEdit({{$contact->id}})" wire:loading.attr="disabled">
// in component
public function confirmContactEdit(Contact $contact = null, $entreprise = null){
if($contact)
$this->contact = $contact;
if($enterprise)
$this->entreprise = $entreprise;
$this->confirmingContactAdd = true;
}