拉拉维尔的未知吸气剂

时间:2017-02-13 09:02:57

标签: laravel laravel-5.3 blade laravel-blade

我在我的应用中设置了谷歌分析,用于构建仪表板。当我dd();我在enter image description here

中获取数据时

当我运行此代码时:

    @foreach($datas as $data)
        @foreach($data as $dat)
            {{$dat}}
        @endforeach
    @endforeach

它提供单行收集的所有数据。当我跑:

    @foreach($datas as $data)
        @foreach($data as $dat)
            {{$dat->pageViews}}
        @endforeach
    @endforeach

抛出错误Unknown getter 'pageViews'

1 个答案:

答案 0 :(得分:1)

而不是使用你的循环

@foreach($datas as $data)
    @foreach($data as $dat)
        {{$dat->pageViews}}
    @endforeach
@endforeach

你必须使用它

@foreach($datas as $data)
    @foreach($data as $dat)
        {{$dat['pageViews']}}
    @endforeach
@endforeach