samedi 30 juillet 2016

Is it a good idea to edit .env dynamically in Laravel 5?

I need to make some settings of my Laravel 5 app configurable to end users through front-end interface. My initial thoughts were to utilize Cache facade, getting user-defined configs from there:

<?php
// app/config/custom_settings.php

return [
    'key' => Cache::get('key');
];

However, It appears, that Facades are loaded after the config files in Laravel, so the above code doesn't work.

Because of this, I am thinking about writing the user's configuration directly into .env file programmatically. Is this a good idea, or can it turn into a headache in the future?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire