i try to display child table record but when i display then error like
Trying to get property 'multiple_doc' of non-object
here is my blade file
<img src="{{asset('/PG/doc/'.$view->user_id.'/'.$doc->multipledocs->multiple_doc)}}" alt="image">
here is my controller file
public function profile($id)
{
$view = Pg::where('user_id','=',$id)->first();
$doc = Document::where('user_id','=',$id)->first();
return view('viewprofile',compact('view','doc'));
}
here is my document model
protected $fillable = [
'user_id','doc_type', 'doc_name', 'doc_number'
];
public function docs()
{
return $this->hasMany('App\Multipledocument');
}
here is my multipledocument modal
protected $fillable = [
'doc_id','multiple_doc'
];
public function multipledocs()
{
return $this->belongsTo('App\Document','doc_id');
}
here document is my parent table and multipledocument my child table so how can i display
thank you