Skip to content

Commit c36abcd

Browse files
authored
Update Uuid.php
1 parent 6e3c523 commit c36abcd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Utils/Uuid.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace ZhenMu\Support\Utils;
44

5+
use Illuminate\Support\Facades\DB;
6+
57
class Uuid
68
{
79
public static function uuid($hex = true)
@@ -15,7 +17,7 @@ public static function uuid($hex = true)
1517

1618
public static function getCurrentSerialNumber(string $modelClass, $serialNumberField = 'serial_number'): int
1719
{
18-
return $modelClass::whereDate('created_at', now())->max($serialNumberField) ?? 0;
20+
return $modelClass::whereDate('created_at', now())->max(DB::raw("cast({$serialNumberField} as INTEGER)")) ?? 0;
1921
}
2022

2123
public static function generateNextSerialNumberNo(int $serialNumber, int $padLength = 3): string

0 commit comments

Comments
 (0)