访问 Laravel 中的对象数据
Accessing Object Data in Laravel
我对访问对象中的数据有疑问;这是对象:
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 ▶}
]
}
我需要访问航向数据;我知道如何访问这些项目。
如果这就是您的意思,您可以使用 getAttributes()
方法获取模型属性。
所以如果你在变量中有模型 object 我很确定你可以 $model->getAttributes()
来给你所有那些 headers.
我对访问对象中的数据有疑问;这是对象:
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 ▶}
]
}
我需要访问航向数据;我知道如何访问这些项目。
如果这就是您的意思,您可以使用 getAttributes()
方法获取模型属性。
所以如果你在变量中有模型 object 我很确定你可以 $model->getAttributes()
来给你所有那些 headers.