1

I've spent some time looking to change the value of app name dynamically through a controller so that I can allow a website admin to change the website name whenever it's required.

As a developer, I can change app name by going to .env file and change APP_NAME value

APP_NAME=laravel

Also, I can visit app.php file inside App\Config and change the name value

'name' => env('APP_NAME', 'Laravel'),

How can I make a HTML form that calls a controller method when submitting it and gets a value to override this value in either .env file or app.php file ?

Thank you.

Red John
  • 105
  • 3
  • 11
  • Laravel does not support this, you will have to implement it yourself. Some things to consider: 1. You should only edit the `.env` file and not the `config/app.php` file, since the config file is committed in your VCS. 2. You will have to recache the config with `php artisan config:cache` after making changes to the `.env` file otherwise your changes wont take effect. – Remul Feb 15 '21 at 15:28
  • This answer helped me. It may solve your purpose. [See this](https://stackoverflow.com/a/53837759/12034985) – Newton Samaddar Aug 12 '21 at 12:32

0 Answers0