php - Laravel Facades - Passing parameter to __construct() -
If I'm making a mask, and I want to pass the parameter before it's instant, what should I do?
The mask is resolved through the IoC container, so what you need to do is properly tie it . Create
, and whatever you want, pass
brighten up \ Support \ ServiceProvider; Class FooServiceProvider ServiceProvider Extended {Public Function Register () {$ this-> App- & gt; Tie ('foo', function) {new fu ('whatever you want');}; }}
Do not forget to load the service provider in your app's configured array.
Then use that bound key in your mask:
are spread in square bar {protected static function getFacadeAccessor () {return 'foo'; }}
Comments
Post a Comment