Get Environment Value In Controller
In my .env file I have the following:
IMAP_HOSTNAME_TEST=imap.gmail.com [email protected] IMAP_PASSWORD_TEST=mypw
Now I would like to use them in my controller. I've tried this, but without any result:
$hostname = config('IMAP_HOSTNAME_TEST');
The $hostname variable is equal to null. How can I use these configuration variables in my controller?
Try it with:
<?php $hostname = env("IMAP_HOSTNAME_TEST", "somedefaultvalue"); ?>
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?