使用链式查询得到的数据如何转为数组
DB::table($this->table)->orderBy('bar_reall_id','asc')->get() 得到的数据最后是一个对象,由于使用数组习惯了,突然用对象不习惯,想请问一下,如何修改能使得最后结果变为对象,toarray()只是第一层是数组,第二层依旧是对象,例外一个map(function ($value) {return (array)$value;})->toarray(),若是每次都这样使用,太麻烦,请教一下,有没有更方便的方法
推荐文章: