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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With