From 45d7c905dee9e18ad1203c5660009e411ee6fc62 Mon Sep 17 00:00:00 2001 From: gzydong <837215079@qq.com> Date: Thu, 16 Sep 2021 22:41:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helper.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/helper.php b/app/helper.php index a1b4005..71546dc 100644 --- a/app/helper.php +++ b/app/helper.php @@ -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; }