Reputation: 2469
public function register() {
$this->app->singleton('Qwerty', function ($app) {
return new QwertyManager();
});
}
This is what my singleton class looks like now i want to reset the singleton object or destroy its instance via laravel. I am using 5.3
Upvotes: 11
Views: 7238
Reputation: 40909
You can call forgetInstance() on the service container to remove it. As the doc's say, this method can be used to Remove a resolved instance from the instance cache
.
App::forgetInstance('Querty');
Next time you'll try to get an instance of this service from the container, it will be re-created using the function you provided in the singleton() method.
Upvotes: 22