优化代码

main
gzydong 2021-09-16 22:41:36 +08:00
parent 7430f86fb2
commit 45d7c905de
1 changed files with 6 additions and 0 deletions

View File

@ -252,5 +252,11 @@ function toPaginate($model, array $fields = ['*'], int $page = 1, int $size = 15
if ($total > 0) $data['rows'] = $model->forPage($page, $size)->get($fields)->toArray();
if ($data['rows'] && $model instanceof QueryBuilder) {
foreach ($data['rows'] as &$row) {
$row = (array)$row;
}
}
return $data;
}