Files
panel-pelican-dev/app/Providers/HashidsServiceProvider.php

27 lines
705 B
PHP
Raw Normal View History

<?php
2024-03-12 22:39:16 -04:00
namespace App\Providers;
2024-03-12 22:39:16 -04:00
use App\Extensions\Hashids;
use Illuminate\Support\ServiceProvider;
2024-03-12 22:39:16 -04:00
use App\Contracts\Extensions\HashidsInterface;
class HashidsServiceProvider extends ServiceProvider
{
/**
* Register the ability to use Hashids.
*/
2023-02-23 12:30:16 -07:00
public function register(): void
{
$this->app->singleton(HashidsInterface::class, function () {
return new Hashids(
2024-03-16 23:29:12 -04:00
config('hashids.salt', ''),
config('hashids.length', 0),
config('hashids.alphabet', 'abcdefghijkmlnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')
);
});
$this->app->alias(HashidsInterface::class, 'hashids');
}
}