如何在laravel刀片中传递多维数组?

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

enter image description here

Thanks

The blade template tags {{ }} are replaced with an echo(). You can't echo an array. You need to get the string out of the array that you want to display, for example:

@foreach($userArr as $users)
    <h2>{{ $users['name'] }}</h2>                                                                
@endforeach