Laravel : 不能显示多个 table
Laravel : Can't display more than one table
我正在使用他的 id
获取特定联系人的数据,如下所示:
<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>
显示他的信息时,我只有联系人table的信息,没有entreprise[=30]的信息=].当我删除 Contact $contact
和 $this->contact = $contact;
时,我会单独显示企业的信息,而无需联系。 因此它们中的任何一个正在显示。
Contact.php
public function confirmContactEdit(Contact $contact, Entreprise $entreprise){
$this->contact = $contact;
$this->entreprise = $entreprise;
$this->confirmingContactAdd = true;
}
如果您的方法需要两个参数,但通过 blade 您只想传递一个参数,您可以这样做
// 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;
}
我正在使用他的 id
获取特定联系人的数据,如下所示:
<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>
显示他的信息时,我只有联系人table的信息,没有entreprise[=30]的信息=].当我删除 Contact $contact
和 $this->contact = $contact;
时,我会单独显示企业的信息,而无需联系。 因此它们中的任何一个正在显示。
Contact.php
public function confirmContactEdit(Contact $contact, Entreprise $entreprise){
$this->contact = $contact;
$this->entreprise = $entreprise;
$this->confirmingContactAdd = true;
}
如果您的方法需要两个参数,但通过 blade 您只想传递一个参数,您可以这样做
// 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;
}