Answers for "purpose of env file in laravel"

PHP
0

what is app_env in laravel

Laravel 5 uses .env file to configure your app. .env should not be committed on your repository, like github or bitbucket. On your local environment your .env will look like the following:

# .env
APP_ENV=local
For your production server, you might have the following config:

# .env
APP_ENV=production
Posted by: Guest on August-19-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

Browse Popular Code Answers by Language