Torann / laravel-currency

This provides Laravel with currency functions such as currency formatting and conversion using up-to-date exchange rates.
http://lyften.com/projects/laravel-currency
BSD 2-Clause "Simplified" License
392 stars 137 forks source link

Registering as singleton? #42

Closed sebestenyb closed 7 years ago

sebestenyb commented 8 years ago

I wonder if the service should be registered as singleton.

The current $this->app->bind doesn't seem to work for me, the currency got reset to null in the service.

public function registerCurrency()
{
    $this->app->singleton('currency', function ($app) {
        $config = $app->config->get('currency', []);
        return new Currency($config, $app['cache']);
    });
}
Torann commented 7 years ago

Yeah, I was running into the same problem. It's been fixed in v0.3.2

https://github.com/Torann/laravel-currency/releases/tag/0.3.2