I have this class called Book
and I want to have one global variable sort of thing in that class which consist of an exchange rate (For whole data/model) I am trying to use service containers to inject the variable in it but I am sort of loss here
I tried this code within AppServiceProvider.php
in the register()
method, but it doesn't work.
$variable = 'something';
$this->app->bind('App\Models\FrontEnd\Book', function ($app) {
return new $variable;
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire