jeudi 27 octobre 2016

retriving enviroment variable in Laravel

I have a Laravel 5 Application. I created some custom classes and added them in the project using classmap in the composer.json and until here everything work perfectly, but now I need to access some enviroment variables (the ones saved in the .env file) I tried:

$variable= env('MyVariable','MydefaultValue');

But it's not working, also tried including use App;and then retrieving the variable like this:

$variable= App::environment('MyVariable', 'MydefaultValue');

But it's not working. So now I'm wondering if is it possible, or I am not retriving the variable properly?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire