Answers for "laravel upload to server setting env"

PHP
2

laravel commands to refresh env file

// NOTE: Five most important commands if your Laravel is not working
//	     as expected after some modifications in .env or database folder

php artisan config:clear
php artisan cache:clear
composer dump-autoload
php artisan view:clear
php artisan route:clear
Posted by: Guest on January-27-2021
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