无法将元素从数组传递到视图

问题描述

尝试将失败的值作为单独的值从此数组传递到视图中:

  #items: array:1 [▼
    0 => {#548 ▼
      +"location": "Guadalajara"
      +"location_id": 34
    }
  ]
}

此数组位于左联接查询之后

$default_loc = DB::table('users')
                ->leftJoin('locations','users.location_id','=','locations.id')
                ->where('users.id',auth()->user()->id)
                ->select('location','location_id')
                ->get();

如果我尝试通过compact('default_loc')将此数组传递给视图,那么我只能使用{{ $default_loc }}显示整个数组,如上所示,但不能将其分成{{1 }}和$default_loc->location

谢谢大家

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)