I need to get the ID and Name fields from my pivot table, I've tried this
public function Display(){
$langservice = new langService();
$musgroups=$langservice->getMusgroup(session()->get('lang_id'));
foreach($musgroups as $musgroup1){
foreach($musgroup1 as $musgroup){
echo 'name:'+$musgroup->name;
}
}
But this error appears:
"Trying to get property of non-object".
I tried to do print_r($musgroups);
but that brings the whole table in loop 12 times.