Skip to content

Commit 3ed58a8

Browse files
authored
Add sqlsrv query (#21)
1 parent cee2465 commit 3ed58a8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/Http/Controllers/DashboardStatsController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ public function index() {
6767
->when($dbDriverName === 'pgsql', function ($q) {
6868
return $q->addSelect(DB::raw('(EXTRACT(EPOCH FROM created_at - updated_at)) as duration'));
6969
})
70+
->when($dbDriverName === 'sqlsrv', function ($q) {
71+
return $q->addSelect(DB::raw('DATEDIFF(SECOND, created_at, updated_at) as duration'));
72+
})
7073
->where('status', '!=', 'pending')
7174
->orderBy('duration')
7275
->first();

0 commit comments

Comments
 (0)