I am working on an application in laravel 5.5 that works with tabs (personal data) and I have the respective table I also have a table communes that is related to the tabs table is to say a one-to-one relationship a tab can have a commune, I have several chips and when I go to look for the relationship with the communes I get the error I will show you my code
the method of myController tab
public function BuscarFicha(){
$fichas= fichas::all();
$fichas->comuna;
//dd($fichas);
return view('Ficha.BuscarFicha',compact('fichas'));
}
the chip model
public function comuna()
{
return $this->belongsTo(comunas::class);
}
if I do it like that
$fichas->first();
$fichas->comuna();
No problem but I want to bring all the chips, in which I can be wrong?