Skip to content

Commit

Permalink
bound configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellvanw committed Apr 25, 2013
1 parent b83f09a commit 005725e
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions src/Mitchellvanw/Hashids/HashidsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,37 @@ public function boot()
*
* @return void
*/

public function register()
{
$salt = $this->getSalt();
$legnth = $this->getLength();
$this->registerHashidsSalt();

$this->registerHashidsLength();

$this->registerHashids();
}

$this->app['hashids'] = $this->app->share(function($app) use ($salt, $length)
protected function registerHashidsSalt()
{
$this->app->bind('hashids.salt', function()
{
return $this->getSalt();
});
}

protected function registerHashidsLength()
{
$this->app->bind('hashids.length', function()
{
return $this->getLength();
});
}

protected function registerHashids()
{
$this->app['hashids'] = $this->app->share(function($app)
{
return new Hashids($salt, $length);
return new Hashids($app->make('hashids.salt'), $app->make('hashids.length'));
});
}

Expand Down

0 comments on commit 005725e

Please sign in to comment.