此集合实例上不存在属性[jenis_penyedia]

问题描述 投票:0回答:2

属性[jenis_penyedia]在此集合实例上不存在。

   @php $no = 1; @endphp
        @foreach($profile as $p)
            <tr>
              <td>{{ $no++ }}</td>
              <td>{{ $p->jenis->jenis_penyedia }}</td>
              <td>{{ $p->nama }}</td>
              <td>{{ $p->no_ktp }}</td>
              <td>{{ $p->npwp }}</td>
              <td>{{ $p->bank }}</td>
              <td>{{ $p->no_rek }}</td>
              <td>{{ $p->email }}</td>
              <td>{{ $p->no_telp }}</td>
              <td>{{ $p->keahlian }}</td>
              <td>{{ $p->pengalaman }}</td>
              <td>{{ $p->alamat }}</td>
              <td>{{ $p->pendidikan }}</td>
              <td>

enter image description hereenter image description hereenter image description here

enter image description here

enter image description here

enter image description here

php laravel eloquent relation
2个回答
0
投票

急于将您的詹妮斯载入个人资料。

$profile = Profile::with('jenis')->get();

0
投票

$p->jenis是雄辩的收藏。此Collection可能包含许多Jenis模型实例(由于[C​​0]关系定义)。这些模型具有属性hasMany,而不具有Collection。

您可能需要确定要获得该属性的模型,因为可能有很多模型,也可能没有。也许使用第一个可以满足您的需求:

jenis_penyedia
© www.soinside.com 2019 - 2024. All rights reserved.