Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
vendor
/
vinkla
/
hashids
/
src
:
HashidsServiceProvider-20250318145532.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php /** * Copyright (c) Vincent Klaiber * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @see https://github.com/vinkla/laravel-hashids */ declare(strict_types=1); namespace Vinkla\Hashids; use Hashids\Hashids; use Illuminate\Contracts\Container\Container; use Illuminate\Support\ServiceProvider; class HashidsServiceProvider extends ServiceProvider { public function boot(): void { $this->setupConfig(); } protected function setupConfig(): void { $source = realpath($raw = __DIR__ . '/../config/hashids.php') ?: $raw; $this->publishes([$source => config_path('hashids.php')]); $this->mergeConfigFrom($source, 'hashids'); } public function register(): void { $this->registerFactory(); $this->registerManager(); $this->registerBindings(); } protected function registerFactory(): void { $this->app->singleton('hashids.factory', function () { return new HashidsFactory(); }); $this->app->alias('hashids.factory', HashidsFactory::class); } protected function registerManager(): void { $this->app->singleton('hashids', function (Container $app) { $config = $app['config']; $factory = $app['hashids.factory']; return new HashidsManager($config, $factory); }); $this->app->alias('hashids', HashidsManager::class); } protected function registerBindings(): void { $this->app->bind('hashids.connection', function (Container $app) { $manager = $app['hashids']; return $manager->connection(); }); $this->app->alias('hashids.connection', Hashids::class); } public function provides(): array { return [ 'hashids', 'hashids.factory', 'hashids.connection', ]; } }