Skip to content

Commit 397d25c

Browse files
committed
fix(后台): 修复使用表前缀进行数据库迁移后查询认证管理报错
#451
1 parent c32ee17 commit 397d25c

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

app/Http/Controllers/Admin/CertificationController.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,12 @@ public function index(Request $request)
7676
*/
7777
protected function certificationCount()
7878
{
79-
$counts = \DB::select('
80-
SELECT
81-
COUNT(status) AS `全部认证用户:`,
82-
COUNT(CASE WHEN status=0 THEN 1 ELSE NULL END ) AS `待审核用户:`,
83-
COUNT(CASE WHEN status=1 THEN 1 ELSE NULL END ) AS `已认证用户:`,
84-
COUNT(CASE WHEN status=2 THEN 1 ELSE NULL END ) AS `驳回用户:`
85-
FROM `certifications`'
86-
);
87-
88-
return $counts;
79+
return [
80+
'全部认证用户:' => Certification::count(),
81+
'待审核用户:' => Certification::where('status', 0)->count(),
82+
'已认证用户:' => Certification::where('status', 1)->count(),
83+
'驳回用户:' => Certification::where('status', 2)->count(),
84+
];
8985
}
9086

9187
/**

0 commit comments

Comments
 (0)