public function get($key)
{
$env = $this->parseFile();
$result = $env->filter(function (Collection $value) use($key) {
return $value->first() == $key;
})->first();
return $result instanceof Collection ? $result->get(1) : $result;
}
/** * Execute the console command. * * @return void */ public function handle() { $env = new Env(base_path('.env')); $key = strtoupper($this->argument('key')); $result = str_replace('"', '', $env->get($key)); if ($result == '' || is_null($result)) { return $this->error("Could not find a value for [{$key}] in your .env file."); } return $this->comment("The value for [{$key}] is \"{$result}\"."); }