我对访问对象中的数据有疑问;这是对象:
RowCollection {#2909 ▼
#heading: array:11 [▼
0 => "account_level_i"
1 => "account_level_ii"
2 => "account_level_iii"
3 => "date"
4 => "transaction_type"
5 => "num"
6 => "name"
7 => "class"
8 => "memodescription"
9 => "split"
10 => "amount"
]
#title: "Profit and Loss Detail"
#items: array:6 [▼
0 => CellCollection {#2915 ▼
#title: null
#items: array:11 [▼
"account_level_i" => " Income"
"account_level_ii" => " 4000-1 Life Insurance"
"account_level_iii" => " 4000-1 Life Insurance"
"date" => "05/09/2018"
"transaction_type" => "Deposit"
"num" => null
"name" => "John Hancock"
"class" => "Wealth"
"memodescription" => "JOHN HANCOCK USA AG PREAUTHORIZED ACH CREDIT JOHN HANCOCK USA AGENCYIND 180509"
"split" => "1000-6 People's Bank Checking"
"amount" => 2265.1
]
}
1 => CellCollection {#2919 ▶}
2 => CellCollection {#2923 ▶}
3 => CellCollection {#2927 ▶}
4 => CellCollection {#2931 ▶}
5 => CellCollection {#2935 ▶}
]
}
我需要访问标题数据;我知道如何访问这些项目。
答案 0 :(得分:1)
如果这就是您的意思,则可以使用getAttributes()
方法获取模型属性。
因此,如果您将模型对象包含在变量中,我很确定您可以执行$model->getAttributes()
为您提供所有这些标头。