-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathHashidsServiceProvider.php
More file actions
51 lines (45 loc) · 915 Bytes
/
Copy pathHashidsServiceProvider.php
File metadata and controls
51 lines (45 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php namespace Mitch\Hashids;
use Hashids\Hashids;
use Illuminate\Support\ServiceProvider;
class HashidsServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$configPath = __DIR__ . '/../../config/hashids.php';
$this->mergeConfigFrom($configPath, 'hashids');
$this->publishes([$configPath => config_path('hashids.php')]);
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->registerHashids();
}
protected function registerHashids()
{
$this->app->bind('Hashids\Hashids', function () {
return new Hashids(
config('app.key'),
config('hashids.length'),
config('hashids.alphabet')
);
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array('Hashids\Hashids');
}
}