Skip to content

Commit

Permalink
feat: add more info to about command
Browse files Browse the repository at this point in the history
  • Loading branch information
calebdw committed Jul 21, 2024
1 parent 7b68a77 commit c3317e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ $request->validate([
]);
```

You can also just use the `Str` macro to check if a value is a valid Snowflake:
You can also just use the `Str::isSnowflake` macro to check if a value is a valid Snowflake:

```php
use Illuminate\Support\Str;
Expand All @@ -203,7 +203,6 @@ to ensure that numbers generated on the same machine within the same millisecond

By default, if the application has a cache, then it uses the `LaravelSequenceResolver`
which uses the Laravel cache to store the last sequence number.

If the application does not have a cache, then it uses the `RandomSequenceResolver` which
has no dependencies **but is not concurrency-safe**.

Expand Down
16 changes: 12 additions & 4 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,18 @@ public function boot(): void

$this->registerMixins();

AboutCommand::add('Laraflake', fn () => [
'Sequence Resolver' => $this->getPrettyResolver(),
'Version' => InstalledVersions::getPrettyVersion('calebdw/laraflake'),
]);
AboutCommand::add('Laraflake', function () {
/** @var array{datacenter_id: int, worker_id: int, epoch: string} $config */
$config = config('laraflake');

return [
'Epoch' => $config['epoch'],
'Datacenter ID' => $config['datacenter_id'],
'Worker ID' => $config['worker_id'],
'Sequence Resolver' => $this->getPrettyResolver(),
'Version' => InstalledVersions::getPrettyVersion('calebdw/laraflake'),
];
});
}

/** Register custom mixins. */
Expand Down

0 comments on commit c3317e6

Please sign in to comment.