Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Providers/HashidsServiceProvider.php
7432 views
1
<?php
2
3
namespace Pterodactyl\Providers;
4
5
use Pterodactyl\Extensions\Hashids;
6
use Illuminate\Support\ServiceProvider;
7
use Pterodactyl\Contracts\Extensions\HashidsInterface;
8
9
class HashidsServiceProvider extends ServiceProvider
10
{
11
/**
12
* Register the ability to use Hashids.
13
*/
14
public function register(): void
15
{
16
$this->app->singleton(HashidsInterface::class, function () {
17
/** @var \Illuminate\Contracts\Config\Repository $config */
18
$config = $this->app['config'];
19
20
return new Hashids(
21
$config->get('hashids.salt', ''),
22
$config->get('hashids.length', 0),
23
$config->get('hashids.alphabet', 'abcdefghijkmlnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')
24
);
25
});
26
27
$this->app->alias(HashidsInterface::class, 'hashids');
28
}
29
}
30
31