@@ -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(); |
@@ -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 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function next(): string |
203 | 203 | { |
204 | - $id = Cache::lock($this->getCacheKey('lock'))->get(function () { |
|
204 | + $id = Cache::lock($this->getCacheKey('lock'))->get(function() { |
|
205 | 205 | $timestamp = $this->timeGen(); |
206 | 206 | |
207 | 207 | // 如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常 |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | private function getLastTimestamp(): ?Carbon |
269 | 269 | { |
270 | - return Cache::rememberForever($this->getCacheKey('last timestamp'), function () { |
|
270 | + return Cache::rememberForever($this->getCacheKey('last timestamp'), function() { |
|
271 | 271 | return null; |
272 | 272 | }); |
273 | 273 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | private function getSequence(Carbon $tts): int |
287 | 287 | { |
288 | 288 | $key = $this->getCacheKey([$tts->timestamp, $tts->millisecond]); |
289 | - $sequence = Cache::remember($key, 1, function () { |
|
289 | + $sequence = Cache::remember($key, 1, function() { |
|
290 | 290 | return -1; |
291 | 291 | }); |
292 | 292 | $sequence = ($sequence + 1) & $this->sequenceMask; |