Files

32 lines
867 B
PHP
Raw Permalink Normal View History

2017-09-09 23:55:21 -05:00
<?php
2026-10-05 18:10:18 -04:00
declare(strict_types=1);
2017-09-09 23:55:21 -05:00
namespace Pterodactyl\Providers;
2026-10-11 16:09:53 -04:00
use Illuminate\Config\Repository;
2017-09-09 23:55:21 -05:00
use Illuminate\Support\ServiceProvider;
use Pterodactyl\Contracts\Extensions\HashidsInterface;
2026-10-05 18:10:18 -04:00
use Pterodactyl\Extensions\Hashids;
2017-09-09 23:55:21 -05:00
class HashidsServiceProvider extends ServiceProvider
{
/**
* Register the ability to use Hashids.
*/
2023-02-23 12:30:16 -07:00
public function register(): void
2017-09-09 23:55:21 -05:00
{
2026-10-05 18:10:18 -04:00
$this->app->singleton(function (): HashidsInterface {
$config = $this->app->make(Repository::class);
2017-09-09 23:55:21 -05:00
return new Hashids(
2026-10-11 16:09:53 -04:00
$config->string('hashids.salt', ''),
2026-10-11 19:15:22 -04:00
$config->integer('hashids.length'),
2026-10-11 16:09:53 -04:00
$config->string('hashids.alphabet', 'abcdefghijkmlnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')
2017-09-09 23:55:21 -05:00
);
});
$this->app->alias(HashidsInterface::class, 'hashids');
}
}