Answers
As @maiorano84 mentioned you can not do this with Facades
out of the box.
To answer your question, to make your Custom
facade return a new instance you could add the following method to it:
/**
* Resolve a new instance for the facade
*
* @return mixed
*/
public static function refresh()
{
static::clearResolvedInstance(static::getFacadeAccessor());
return static::getFacadeRoot();
}
Then you could call:
Custom::refresh()->showValue();
(Obviously, you can call refresh
something else if you want to)
One alternative to this would be to use the app()
global function that comes with Laravel to resolve a new instance i.e.
app('custom')->showValue();
Hope this helps!
0 comments:
Post a Comment
Thanks