1
私は雄弁を使って2つのテーブルの間でデータを取得しようとするとエラーが発生します。 くれている与えているエラー:テーブルの関係のエラー
Error:
Trying to get property of non-object (View:
これは、あなたがそれらを直接使用する必要があります私のアプリ情報
DB:
survey:
- id;
- template_id;
- title;
templates:
- id;
- name;
- internal_name;
SurveyModel:
public function theme(){
return $this->hasOne(Template::class, 'template_id','id');
}
View:
@foreach($surveys->reverse() as $survey)
<tr>
<td>{{$survey->template_id->theme}}</td>
</tr>
@endforeach