mardi 2 avril 2019

How to use ENV variables in Artisan Commands in Laravel 5.8?

I am creating my own artisan command and I want to use ENV variables, but when I use $_ENV['VariableName'] I get and error.

local.ERROR: Undefined index: VariableName

The same code works perfectly in a controller and error as this one is not being generated.

I am creating my commands with php artisan make:command CommandName

How can I start using ENV variables there? Thank you!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire