/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $m = Mapper::map(42.322639, -71.07284900000001, ['zoom' => 6, 'center' => true, 'marker' => true, 'type' => 'ROADMAP']); $data['census_apikey'] = \Dotenv::findEnvironmentVariable('CENSUS_APIKEY'); $data['map'] = $m; $data['id'] = 'census'; return view('map', $data); }
} protected static function resolveNestedVariables($value) { if (strpos($value, '$') !== false) { $value = preg_replace_callback('/{\\$([a-zA-Z0-9_]+)}/', function ($matchedPatterns) { $nestedVariable = Dotenv::findEnvironmentVariable($matchedPatterns[1]); if (is_null($nestedVariable)) { return $matchedPatterns[0]; } else { return $nestedVariable; } }, $value); } return $value;
/** * collect vars and sets them to the DIC * * @param Container $app */ protected function addEnvVarsToApp(Container $app) { $hasPrefix = function ($elem) use($app) { return strpos($elem, $app['env.options']['prefix'] . '_') !== false; }; $arrayFilterKeys = function ($input, $callback) { if (!is_array($input)) { trigger_error('array_filter_key() expects parameter 1 to be array, ' . gettype($input) . ' given', E_USER_WARNING); return null; } if (empty($input)) { return $input; } $filteredKeys = array_filter(array_keys($input), $callback); if (empty($filteredKeys)) { return array(); } $input = array_intersect_key(array_flip($filteredKeys), $input); return $input; }; $envVars = $arrayFilterKeys($_ENV, $hasPrefix); $envVars = array_merge($arrayFilterKeys($_SERVER, $hasPrefix), $envVars); foreach ($envVars as $envVar => $empty) { $var = \Dotenv::findEnvironmentVariable($envVar); if ($var) { $key = strtolower(str_replace($app['env.options']['prefix'] . '_', '', $envVar)); $app[$key] = $var; } } }
/** * Return an env var name. * @param $key string * @return string */ function env($key) { return Dotenv::findEnvironmentVariable($key); }
/** * */ public function __construct() { Dotenv::load(__DIR__ . '/..'); $this->baseUrl = Dotenv::findEnvironmentVariable('APP_URL'); }