@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | protected static function boolSnowflake() |
| 22 | 22 | { |
| 23 | - static::saving(function ($model) { |
|
| 23 | + static::saving(function($model) { |
|
| 24 | 24 | if (is_null($model->getKey())) { |
| 25 | 25 | $model->setIncrementing(false); |
| 26 | 26 | $keyName = $model->getKeyName(); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function next(): ?string |
| 194 | 194 | { |
| 195 | - return Cache::lock($this->getCacheKey('lock'))->get(function () { |
|
| 195 | + return Cache::lock($this->getCacheKey('lock'))->get(function() { |
|
| 196 | 196 | $timestamp = $this->timeGen(); |
| 197 | 197 | |
| 198 | 198 | // 如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常 |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | private function getLastTimestamp(): ?Carbon |
| 253 | 253 | { |
| 254 | - return Cache::rememberForever($this->getCacheKey('last timestamp'), function () { |
|
| 254 | + return Cache::rememberForever($this->getCacheKey('last timestamp'), function() { |
|
| 255 | 255 | return null; |
| 256 | 256 | }); |
| 257 | 257 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | private function getSequence(Carbon $tts): int |
| 271 | 271 | { |
| 272 | 272 | $key = $this->getCacheKey([$tts->timestamp, $tts->millisecond]); |
| 273 | - $sequence = Cache::remember($key, 1, function () { |
|
| 273 | + $sequence = Cache::remember($key, 1, function() { |
|
| 274 | 274 | return -1; |
| 275 | 275 | }); |
| 276 | 276 | $sequence = ($sequence + 1) & $this->sequenceMask; |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $this->mergeConfigFrom( |
| 25 | 25 | dirname(__DIR__) . '/../config/snowflake.php', 'snowflake' |
| 26 | 26 | ); |
| 27 | - $this->app->singleton('snowflake', function ($app) { |
|
| 27 | + $this->app->singleton('snowflake', function($app) { |
|
| 28 | 28 | return new Snowflake($app->config['snowflake']); |
| 29 | 29 | }); |
| 30 | 30 | } |