没有关于模型的查询结果
在我的控制器中
public function cassocialshow(Request $request, $id)
{
if(!in_array(\Auth::user()->role, ['validation','guichet'])) return redirect()->back();
$admission = Admission::findOrFail($id);
$dossiersocials = \App\Dossiersocial::findOrFail($id);
dd($dossiersocials->toArray());
return view('admissions.cassocialshow', compact('admission'));
}
在我的模型入场中
public function admission(){
return $this->hasOne('\App\Dossierscocial','admission_id');
}
在我的模型Dossiersocial中
public function dossiersocial(){
return $this->belongsTo('\App\Admission','admission_id');
}
在我看来
<td>{{$admission->dossiersocial->admission_id}}</td>
<td>{{$$admission->dossiersocial->nationalite}}</td>
<td>{{$$admission->dossiersocial->status}}</td>
<td>{{$$admission->dossiersocial->remark}}</td>