Normally data retrieved as an object from database in Laravel when we use get()
function. But I want to retrieved data as an array.
通常,当我们使用get()函数时,从Laravel中的数据库中检索数据作为对象。但我想以数组的形式检索数据。
In CodeIgnitor we use get_array()
. What we use in Laravel ?
在CodeIgnitor中,我们使用get_array()。我们在Laravel中使用了什么?
I have already tried with toArray()
. But no result.
我已经尝试过toArray()。但没有结果。
$doctor_result = Doctor::select('*')->toArray();
How to solve that?
怎么解决?
1 个解决方案
#1
0
I got result. just change the code
我得到了结果。只需更改代码
$doctor_result = Doctor::all()->toArray();
#1
0
I got result. just change the code
我得到了结果。只需更改代码
$doctor_result = Doctor::all()->toArray();