Created
November 26, 2022 05:03
-
-
Save Vigowebs/fcd88cbaeb0986702c8a2a0882e6c7e3 to your computer and use it in GitHub Desktop.
Do not get data from the .env file directly. Pass the data to config files instead and then use the config() helper function to use the data in an application.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ❌ | |
$apiKey = env('API_KEY'); | |
// ✔️ | |
// config/api.php | |
'key' => env('API_KEY'), | |
// Use the data | |
$apiKey = config('api.key'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment