I have try to pass the multidimensional array to view. But when I try to print It will give me error. Below are the code and error.
Controller File:
foreach($countrygroup as $val){
//$userArr[] = $val->userid;
$users = DB::table('timelines')->where('id', '=', $val->userid)->first();
$userArr[$val->userid]['name'] = $users->name;//$users->name;
$userArr[$val->userid]['avatar'] = $users->avatar_id;
//$userArr[$val->userid]['image']=$users->image;
}
//echo '<pre>'; print_r($userArr); die();
return $theme->scope('groups/country', compact('userArr','trending_tags','countrygroupnamee'))
->render();
Blade File Code:
@foreach($userArr as $users)
<h2>{{ $users}}</h2>
@endforeach
Thanks