【发布时间】:2018-06-30 02:51:46
【问题描述】:
$somedata = Indicator::all();
$indicators = [];
// ... (re-structure the data; rows to columns)
$indicators[] = ['a'=>'2016', 'b'=>'2017', 'c'=>'2018'];
$indicators[] = ['a'=>'1232', 'b'=>'3242', 'c'=>'5467'];
$indicators[] = ['a'=>'1232', 'b'=>'3242', 'c'=>'5467'];
$indicators[] = ['a'=>'closed', 'b'=>'closed', 'c'=>'open'];>
// ??? How to form a valid object to send ???
return view('indicators.index')->with(['indicators'=> $indicators]);
我选择数据。我改变了显示它的结构;但找不到正确的结构来传递我的回复。
视图抛出错误“尝试获取非对象的属性(视图:”
(我查看了 Indicator::all(); 的转储,想知道我的方法是否正确/错误)
// 菜鸟
【问题讨论】:
-
请显示
indicators/index.blade.php视图
标签: php arrays laravel object response