Answers for "update env laravel"

PHP
2

laravel get env variable

dd(env('APP_NAME'));
Posted by: Guest on October-15-2020
1

laravel update env file programmatically

public static function envUpdate($key, $value)
    {
        $path = base_path('.env');

        if (file_exists($path)) {

            file_put_contents($path, str_replace(
                $key . '=' . env($key), $key . '=' . $value, file_get_contents($path)
            ));
        }
    }

And reload the page programatically again using js only once
<script>
  	window.location.reload();
</script>
Posted by: Guest on June-29-2020
2

laravel APP_ENV config

if (\Illuminate\Support\Facades\App::environment('production')) {
    // The environment is production
}
Posted by: Guest on November-10-2020

Browse Popular Code Answers by Language