1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 17:12:30 +01:00
Pterodactyl-Panel/app/Providers/HashidsServiceProvider.php
2023-02-23 12:30:16 -07:00

30 lines
864 B
PHP

<?php
namespace Pterodactyl\Providers;
use Pterodactyl\Extensions\Hashids;
use Illuminate\Support\ServiceProvider;
use Pterodactyl\Contracts\Extensions\HashidsInterface;
class HashidsServiceProvider extends ServiceProvider
{
/**
* Register the ability to use Hashids.
*/
public function register(): void
{
$this->app->singleton(HashidsInterface::class, function () {
/** @var \Illuminate\Contracts\Config\Repository $config */
$config = $this->app['config'];
return new Hashids(
$config->get('hashids.salt', ''),
$config->get('hashids.length', 0),
$config->get('hashids.alphabet', 'abcdefghijkmlnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')
);
});
$this->app->alias(HashidsInterface::class, 'hashids');
}
}