当我使用 laravel Collection 和 DB 查询分页时。出现以下错误。
new UserCollection(DB::table('users')->paginate());
我正在使用如下的 elequent 分页,
new UserCollection(User::paginate());
它工作正常,如下所示。
我已从 Laravel 5.8 升级到 6。
最佳答案
尝试就是其中之一
User::paginate();
You need to convert stdClass to array
关于php - 使用 db::paginate() 时 laravel API 资源收集错误 "Cannot use object of type stdClass as array",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58229020/